模拟 URAL 1149 Sinus Dances
/*
模拟:找到规律分别输出就可以了,简单但是蛮有意思的
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
using namespace std; const int MAXN = 2e2 + ;
const int INF = 0x3f3f3f3f; void print_An(int n)
{
for (int i=; i<=n; ++i)
{
printf ("sin(%d", i);
if (i < n) printf ("%c", (i&) ? '-' : '+');
} for (int i=; i<=n; ++i) printf ("%c", ')');
} void work(int n)
{
for (int i=; i<n; ++i) printf ("%c", '(');
print_An (); printf ("%c%d", '+', n);
for (int i=n-, j=; i>=; --i)
{
printf ("%c", ')'); print_An (++j);
printf ("%c%d", '+', i);
}
puts ("");
} int main(void) //URAL 1149 Sinus Dances
{
// freopen ("F.in", "r", stdin); int n;
while (scanf ("%d", &n) == )
{
work (n);
} return ;
}
模拟 URAL 1149 Sinus Dances的更多相关文章
- Ural 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+1For given N print SN I ...
- 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 ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- URAL 2046 A - The First Day at School 模拟题
A - The First Day at SchoolTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudg ...
- URAL 1404. Easy to Hack! (模拟)
space=1&num=1404">1404. Easy to Hack! Time limit: 1.0 second Memory limit: 64 MB When Vi ...
- URAL 1993 This cheeseburger you don't need 模拟题
This cheeseburger you don't need 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=1993 Descrip ...
- ural 2020 Traffic Jam in Flower Town(模拟)
2020. Traffic Jam in Flower Town Time limit: 1.0 secondMemory limit: 64 MB Having returned from Sun ...
- ural 2015 Zhenya moves from the dormitory(模拟)
2015. Zhenya moves from the dormitory Time limit: 1.0 secondMemory limit: 64 MB After moving from hi ...
随机推荐
- 前端开发:JavaScript---DOM & BOM
DOM:Document Object Model 文档对象类型 模态框案例 <!DOCTYPE html> <html lang="en"> <h ...
- openstack setup demo Identity service
openstack Identity service 名叫keystone.它提供了用户校验,以及服务目录查询(即列出所有的服务以及相关信息)等功能. keystone 主要包含以下几个部分 Serv ...
- Android 圆形/圆角图片的方法
Android 圆形/圆角图片的方法 眼下网上有非常多圆角图片的实例,Github上也有一些成熟的项目.之前做项目,为了稳定高效都是选用Github上的项目直接用.但这样的结束也是Android开发必 ...
- Codeforces Round #337 (Div. 2) 610B Vika and Squares(脑洞)
B. Vika and Squares time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- cocos2dx 在android平台打开文件问题
我们有一个项目是基于cocos2dx + lua,在网络部分用到了protobuf, 在初始化protobuf的时候须要读取本地文件,用lua的io.open读取文件在windows,ios上 ...
- JOIN a table with a subquery
统计数据产品消耗量与产量 注意join 方向 join中子查询 How to use subquery in JOIN operation in MySQL http://www.geeksengin ...
- 安卓图片载入之使用universalimageloader载入圆形圆角图片
前言 话说这universalimageloader载入图片对搞过2年安卓程序都是用烂了再熟悉只是了.就是安卓新手也是百度就会有一大堆东西出来,今天为什么这里还要讲使用universalimagelo ...
- go1
关键字: break default func interface select case defer go map struct chan else goto package switch cons ...
- 上百例Silverlight网站及演示汇总,供友参考
毁灭2012 博客园 首页 新闻 新随笔 联系 管理 订阅 随笔- 125 文章- 0 评论- 446 上百例Silverlight网站及演示汇总,供友参考 今天我将发现的Silverlig ...
- 学习 Shell —— 认识 shell
0. 认识 shell shell 是一个命令行解释器(interpreter),它会输出一个提示符,等待输入一个命令,然后执行该命令.如果该命令行的第一个单词不是一个内置的 shell 命令,那么 ...