模拟 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 ...
随机推荐
- Linux下汇编语言学习笔记47 ---
这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...
- Linux 攻击防护基础排查
作者:Zzang 来源:cnblogs 原文:https://www.cnblogs.com/Zzang/p/LinuxHack.html 版权声明:本文为博主原创文章,转载请附上博文链接! 基本网络 ...
- mybatis association和collection标签怎么用
<resultMap type="Bill" id="ResultBill"> <id property="id" col ...
- Android之AssetManager使用
1. 获取AssetManager AssetManager assetManager = context.getAssets(); 2. 列出assets文件夹下全部文件 String[] file ...
- http://www.cnblogs.com/sprinkle/
http://www.cnblogs.com/sprinkle/ http://www.cnblogs.com/sprinkle/
- 魔兽 如何屏蔽F1键弹出帮助菜单
如下图所示,我在任何时候按F1键,都会自动弹出Windows帮助和支持,事实上这个功能很鸡肋,从来没用过,但是玩魔兽的时候确实必须的,F1控制英雄的,呵呵. 方法还是有的,在任务管理器中找到这个应 ...
- C++对象模型——指向Member Function的指针 (Pointer-to-Member Functions)(第四章)
4.4 指向Member Function的指针 (Pointer-to-Member Functions) 取一个nonstatic data member的地址,得到的结果是该member在 cl ...
- 最大heap
1 什么是最大heap 最大heap是一棵完全二叉树.每棵子树的根比它的两棵子树上的节点都要大. 2 建堆的过程 function max_heaptify(A): for (i = n/2向下取整: ...
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
[SQL]SELECT username,password,toutiao_uidFROM pwdtab pLEFT JOIN toutiao_action_article aON p.toutiao ...
- vi/vim命令
vi / vim是Unix / Linux上最常用的文本编辑器而且功能非常强大.