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. ...
随机推荐
- java ee环境搭建
1.安装java(tm)2 platform 2.下载安装Java EE SDK 版本:Java Platform,Enterprise Edition 7 SDK (with JDK 7u45) 下 ...
- 升级Xcode6.3插件失效解决办法
1.打开终端,输入以下代码获取到DVTPlugInCompatibilityUUID defaults read /Applications/Xcode.app/Contents/I ...
- RFID标签天线的三种制作方法
在RFID标签中,天线层是主要的功能层,其目标是传输最大的能量进出标签芯片.RFID天线是按照射频识别所要求的功能而设计的电子线路,将导电银浆或导电碳浆网印在PVC.PC或PET上,再与面层.保护层和 ...
- Mysql-udf-http 插件的安装与使用
1. 在Linux系统上安装Mysql-udf-http ulimit -SHn wget http://curl.haxx.se/download/curl-7.21.1.tar.gz .tar ...
- [置顶] java 枚举
1. 什么是枚举?枚举就是用来存放一组固定的常量. 2. 枚举有什么作用?一些程序在运行时,它需要的数据不能是任意的,而必须是一定范围内的值:例如性别 男和女. public enum Gender ...
- HDU 3486 Interviewe
题目大意:给定n个数的序列,让我们找前面k个区间的最大值之和,每个区间长度为n/k,如果有剩余的区间长度不足n/k则无视之.现在让我们找最小的k使得和严格大于m. 题解:二分k,然后求RMQ检验. S ...
- C# Best Practices - Creating Good Properties
Coding Properties Code in the Getter Check the user's credentials Check application state Format the ...
- java的大数类
java中的大数类,真的很方便,不用自己再写计算的函数,先写一个简单的例子,以后再补充 注意大数初始化的时候,参数十字符型的,如果传进去的变量十一个数字,需要加上一个空字符即:+"" ...
- asp.net mvc 客户端(&)中检测到有潜在危险的 Request.Path 值。
出现这个错误后,试过 <pages validateRequest="false"> <httpRuntime requestValidationMode=&qu ...
- Linux内存分析
Linux命令----分析内存的瓶颈 为了提高磁盘存取效率, Linux做了一些精心的设计, 除了对dentry进行缓存(用于VFS,加速文件路径名到inode的转换), 还采取了两种主要Cac ...