Ural 1149 - Sinus Dances
Let Sn = (…(A1+n)A2+n–1)A3+…+2)An+1
For given N print SN
Input
Output
Sample
| input | output |
|---|---|
3 |
((sin(1)+3)sin(1–sin(2))+2)sin(1–sin(2+sin(3)))+1 |
Problem Source: Ural Collegiate Programming Contest, April 2001, Perm, Test Round
// Ural Problem 1149. Sinus Dances
// Verdict: Accepted
// Submission Date: 15:58:23 15 Jan 2014
// Run Time: 0.093s
//
// 版权所有(C)acutus (mail: acutus@126.com)
// 博客地址:http://www.cnblogs.com/acutus/// [解题方法]
// 简单字符串处理
// 注意:所有符号之间没有空格 #include<stdio.h> void An(int n)
{
int i;
for(i = ; i < n; i++) {
printf("sin(%d", i);
if(i%) printf("-");
else printf("+");
}
printf("sin(%d", n);
for(i = ; i <= n; i++) {
printf(")");
}
} void Sn(int n)
{
int i;
for(i = ; i < n; i++) {
printf("(");
}
for(i = ; i < n; i++) {
An(i);
printf("+%d)", n - i + );
}
An(n);
printf("+1\n");
} void solve()
{
int N;
scanf("%d", &N);
Sn(N);
} int main()
{
solve();
return ;
}
Ural 1149 - Sinus Dances的更多相关文章
- 模拟 URAL 1149 Sinus Dances
题目传送门 /* 模拟:找到规律分别输出就可以了,简单但是蛮有意思的 */ #include <cstdio> #include <algorithm> #include &l ...
- Timus 1149. Sinus Dances 打印复杂公式
就是打印以下这两个复杂的式子: Let An = sin(1–sin(2+sin(3–sin(4+-sin(n))-) Let Sn = (-(A1+n)A2+n–1)A3+-+2)An+1 For ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
- ural 2067. Friends and Berries
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...
随机推荐
- [LeetCode]题解(python):108-Convert Sorted Array to Binary Search Tree
题目来源: https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ 题意分析: 给出一个排好序的数组,根据这 ...
- selenium 学习笔记 ---新手学习记录(9) 问题总结(java)
1.百度搜索目标--实例 boolean flag; //点击次数 int shcs=3; int i=0; //窗口焦点控制 String detailWindowHandle = null; // ...
- 转: css3动画简介以及动画库animate.css的使用
~~~ transition animation 和 animate.css 在这个年代,你要是不懂一点点css3的知识,你都不好意思说你是个美工.美你妹啊,请叫我前端工程师好不好.呃..好吧,攻城 ...
- protel99_拼板详细图解
首先打开PCB文档.如图所示,在PCB左下角放置一個坐標為X=0,Y=0的焊盤. 从下图看,为了方便电路板生产厂家的加工和焊接工厂的加工,拼版的方向是向上Y轴方向拼版. 接着为了在拼版过程中好对齐板边 ...
- 分析php获取客户端ip
用php能获取客户端ip,这个大家都知道,代码如下: /** * 获取客户端ip * @param number $type * @return string */ function getClien ...
- Failed to upgrade Oracle Cluster Registry configuration(root.sh)
近期在给客户基于Suse 11 sp3安装Oracle 10g RAC,在安装完clusterware运行/u01/app/crs/root.sh时收到错误提示.Failed to upgra ...
- SpringMVC 详解
一.SpringMVC基础入门,创建一个HelloWorld程序 1.首先,导入SpringMVC需要的jar包. 2.添加Web.xml配置文件中关于SpringMVC的配置 1 2 3 4 5 6 ...
- Quiz 6b Question 8————An Introduction to Interactive Programming in Python
Question 8 We can use loops to simulate natural processes over time. Write a program that calcula ...
- Python之美[从菜鸟到高手]--urlparse源码分析
urlparse是用来解析url格式的,url格式如下:protocol :// hostname[:port] / path / [;parameters][?query]#fragment,其中; ...
- HTML5 音频视频
HTML5 视频和音频的 DOM 参考手册 HTML5 DOM 为 <audio> 和 <video> 元素提供了方法.属性和事件. 这些方法.属性和事件允许您使用 JavaS ...