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. [LeetCode]题解(python):115-Distinct Subsequences

    题目来源: https://leetcode.com/problems/distinct-subsequences/ 题意分析: 给定字符串S和T,判断S中可以组成多少个T,T是S的子串. 题目思路: ...

  2. IOS 特定于设备的开发:UIDevice

    UIDevice类展示了一些关键的特定于设备的属性,包括使用的iPhone ,Ipad或iPod Touch型号.设备名称.以及OS名称和版本. 他是一种一站式解决方案,用于提取出某些系统详细信息.每 ...

  3. UIWebView的三种加载方式

    一.使用UIWebView 将web content 嵌入到应用上. API提供了三种方法: - (void)loadRequest:(NSURLRequest *)request; - (void) ...

  4. MVC-03 控制器(5)

    八.动作过滤器 有时在运行Action之前或之后会需要运行一些逻辑运算,以及处理一些运行过程中所生成的异常状况,为了满足这个需求,ASP.NET MVC提供动作过滤器(Action Filter)来处 ...

  5. ThinkPHP 3.1.2 视图-2

    一.模板的使用 (重点) a.规则 模板文件夹下[TPL]/[分组文件夹/][模板主题文件夹/]和模块名同名的文件夹[Index]/和方法名同名的文件[index].html(.tpl) 更换模板文件 ...

  6. poj 2001 Shortest Prefixes(字典树)

    题目链接:http://poj.org/problem?id=2001 思路分析: 在Trie结点中添加数据域childNum,表示以该字符串为前缀的字符数目: 在创建结点时,路径上的所有除叶子节点以 ...

  7. HDU - 2276 Kiki &amp; Little Kiki 2

    Description There are n lights in a circle numbered from 1 to n. The left of light 1 is light n, and ...

  8. c++ 输出虚函数表内容

    class Base{ public: virtual void f(){cout<<"Base::f"<<endl;} virtual void g(){ ...

  9. config -导航

    在config进行中配置 1在config中添加SITmap  <siteMap enabled="true" defaultProvider="UserSiteM ...

  10. spring注解开发中常用注解以及简单配置

    一.spring注解开发中常用注解以及简单配置 1.为什么要用注解开发:spring的核心是Ioc容器和Aop,对于传统的Ioc编程来说我们需要在spring的配置文件中邪大量的bean来向sprin ...