(2016弱校联盟十一专场10.3) D Parentheses
把左括号看成A右括号看成B,推一下就行了。好久之前写的,推到最后发现是一个有规律的序列。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n;
while(scanf("%lld",&n)!=EOF)
{
ll cnt=,sum=;
for(int i=;; i++)
{
if(sum>=n) break;
cnt++;
sum=sum+cnt;
//printf("%d : %d\n",i,sum);
}
printf(")");
ll a=sum-n;
ll b=cnt-a;
for(int i=;i<=cnt;i++)
{
if(b==i)
printf("(");
else
printf(")");
}
for(int i=;i<cnt-;i++)
printf("(");
puts("");
}
return ;
}
(2016弱校联盟十一专场10.3) D Parentheses的更多相关文章
- 2016弱校联盟十一专场10.5---As Easy As Possible(倍增)
题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8506#problem/A problem description As we know, t ...
- 2016弱校联盟十一专场10.3---Similarity of Subtrees(深搜+hash、映射)
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52310 problem description Define the depth of a ...
- (2016弱校联盟十一专场10.3) B.Help the Princess!
题目链接 宽搜一下就行. #include <iostream> #include<cstdio> #include<cstring> #include<qu ...
- (2016弱校联盟十一专场10.3) A.Best Matched Pair
题目链接 #include<cstdio> #include<cstring> #include<algorithm> #include<stack> ...
- 2016弱校联盟十一专场10.3---We don't wanna work!(STL--set的使用)
题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8504#problem/C 代码如下: #include <iostream> # ...
- 2016弱校联盟十一专场10.2---Around the World(深搜+组合数、逆元)
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52305 problem description In ICPCCamp, there ar ...
- (2016弱校联盟十一专场10.2) A.Nearest Neighbor Search
题目链接 水题,算一下就行. #include <bits/stdc++.h> using namespace std; typedef long long ll; ll x[],y[], ...
- (2016弱校联盟十一专场10.2) E.Coins
题目链接 很久之前写的了,好像是对拍打表过的,推一下就行了. #include <bits/stdc++.h> using namespace std; typedef long long ...
- (2016弱校联盟十一专场10.5) F. Fibonacci of Fibonacci
题目链接 题目大意就是这个,先找出下标的循环节,再快速幂对20160519取余就行了. 找出下标循环节: #include <cstdio> #include <iostream&g ...
随机推荐
- 2016-2017-1 《信息安全系统设计基础》 学生博客及Git@OSC 链接
2016-2017-1 <信息安全系统设计基础> 学生博客及Git@OSC 链接 博客 1452 20145201李子璇 20145202马 超 20145203盖泽双 20145204张 ...
- JS组件系列——分享自己封装的Bootstrap树形组件:jqTree
前言:之前的一篇介绍了下如何封装自己的组件,这篇再次来体验下自己封装组件的乐趣.看过博主博客的园友应该记得之前分享过一篇树形菜单的使用JS组件系列——Bootstrap 树控件使用经验分享,这篇里面第 ...
- CSS选定第k个元素
<!DOCTYPE html> <html> <head> <title></title> <style type="tex ...
- 前端ps常用的小技巧
一些很简单的例子,知道的就当看乐子. 1.T 是文字的 可以从矢量图中查看文字的大小 字体 颜色,具体就是T 选择一段文字,点确定,点击属性栏最后一个可以看详细信息.又字体,行高,颜色.如果要选取 ...
- 81.Android之沉浸式状态栏攻略
转载:http://blog.csdn.net/lmj623565791/article/details/48649563/ 一.概述 近期注意到QQ新版使用了沉浸式状态栏,ok,先声明一下:本篇博客 ...
- POJ 2342 Anniversary party(树形dp)
Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7230 Accepted: 4162 ...
- 多视图学习(multiview learning)
多视图学习(multi-view learning) 前期吹牛:今天这一章我们就是来吹牛的,刚开始老板在和我说什么叫多视图学习的时候,我的脑海中是这么理解的:我们在欣赏妹子福利照片的时候,不能只看45 ...
- elastichq 离线安装
plugin install file:///home/hadoop/xxxx.zip 奇怪的是,这样安装成功后访问host:port:9200/_plugin/hq/ 仍然会报错,找不到一些js函数 ...
- 转-ArcGIS Engine中的License设置
AE开发中的License有两种方法进行设置,一种是通过LicenseControl控件,另一种是通过IAoInitialize接口设置.整个应用程序中只能有一种方式存在,如果进行了两种License ...
- [Nhibernate]二级缓存(二)
目录 写在前面 文档与系列文章 更新数据 二级缓存管理 总结 写在前面 本篇文章也算nhibernate入门系列的结尾了,在总结nhibernate系列的过程中,遇到了很多问题,学习的过程也是解决bu ...