Let An = sin(1–sin(2+sin(3–sin(4+…sin(n))…)
Let Sn = (…(A1+n)A2+n–1)A3+…+2)An+1
For given N print SN

Input

One integer N. 1 ≤ N ≤ 200

Output

Line containing SN

Sample

input output
3
((sin(1)+3)sin(1–sin(2))+2)sin(1–sin(2+sin(3)))+1
Problem Author: Vladimir Gladkov 
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的更多相关文章

  1. 模拟 URAL 1149 Sinus Dances

    题目传送门 /* 模拟:找到规律分别输出就可以了,简单但是蛮有意思的 */ #include <cstdio> #include <algorithm> #include &l ...

  2. 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 ...

  3. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  4. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  5. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  6. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  7. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

  8. 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 ...

  9. ural 2067. Friends and Berries

    2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...

随机推荐

  1. KISSY对vm的抽取

    vm <script type="text/javascript"> KISSY.use(['bops/js/forced-closure', 'common/js/t ...

  2. Sublime 编辑器主题

    Sublime主题分为两种 一种是编辑框中的代码的颜色  另一种是编辑器本身的颜色(不只是颜色哟  Sublime编辑器左边侧边栏的字很小对不对 !有了主题就可以改) 这个主题叫做Soda  http ...

  3. WORD 无格式粘贴 2003 2007 MacOS2011

    2003 打开Word窗口,依次点击“工具----宏----Visual Basic编辑器”,打开“Microsoft visual Basic”窗口,在左侧“工程”栏选中“Normal”工程,点击“ ...

  4. 网上下载的“上下3D”和“左右3D”影片该如何播放?

    我们平常买的红蓝3D眼镜智能播放红蓝3D片源.网上找3D电影的时候,虽试图去找红蓝3D格式电影,但总会找到不少“左右格式”或者"上下格式"影片.正常播放后发现有两重画面.这种3D电 ...

  5. 转 释一首美国民谣:沉默之音(The Sound Of Silence)

    Ask not what your country can do for you , ask what you can do for your country.    六十年代对美国而言是个多事之秋的 ...

  6. hdoj 1824 Let's go home(2-SAT)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1824 思路分析:该问题为2-SAT问题:需要注意逻辑推理的等价性: (1)题目第一个条件:每一个队或者 ...

  7. 【node.js】本地模式安装express:'express' 不是内部或外部命令,也不是可运行的程序或批处理文件。

    今天闲来无事想起了node.js,因此到网上下载了一个node.js的安装程序进行安装.其中: 安装程序:node-v0.11.13-x64.msi PC系统:Windows 7 自定义安装路径:D: ...

  8. java concurrency: ThreadLocal及其实现机制

    转载:http://shmilyaw-hotmail-com.iteye.com/blog/1703382 ThreadLocal概念 从字面上来理解ThreadLocal,感觉就是相当于线程本地的. ...

  9. UVa----------1594(Ducci Sequence)

    题目: 1594 - Ducci Sequence Asia - Seoul - 2009/2010A Ducci sequence is a sequence of n-tuples of inte ...

  10. 《JavaScript权威指南》拾遗(上)

    一.语言基础         1.javascript中,只有null和undefined是无法拥有方法的值,它们都没有包装对象.typeof null == ‘object' , typeof un ...