URAL 1209 110100100010000……
2011-08-04 08:34
309 查看
/* 此题纠结了n久 感觉自己的方法应该是最高效的解法了 但每次提交都超时 后来发现原来是上界弄错了 无语。。。 */ #define LOCAL #include<iostream> #include<cmath> using namespace std; int main() { #ifdef LOCAL freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif int n,first=1;double k;unsigned long t; cin>>n; while(n--){ cin>>k; t=(long)sqrt(2*k);//就是这得上界弄错了 while((t*(t+1))>(2*(k-1))) t-=1; if((t*(t+1))==(2*(k-1))) {if(first){cout<<1;first=0;} else{cout<<" 1";}} else{if(first){cout<<0;first=0;} else{cout<<" 0";}}} cout<<endl; return 0; }
相关文章推荐
- URAL 1518 Jedi Riddle 3 矩阵快速幂
- URAL 1203 Scientific Conference 简单dp 难度:0
- URAL 1197 Lonesome Knight (判断)
- URAL 1581. Teamwork
- URAL 1294. Mars Satellites(余弦定理 数学啊 )
- URAL 1293. Eniya
- URAL 1987. Nested Segments(数学 & 线段树)
- URAL 1826. Minefield 贪心
- URAL 1880. Psych Up's Eigenvalues
- URAL 1613. For Fans of Statistics 二分+stl
- URAL 1114 Boxes (dp)
- URAL - 1009 - K-based Numbers (简单DP)
- [ural1519]Formula 1 && 插头DP(括号表示法)
- URAL - 1828 Approximation by a Progression(最小二乘法)
- ural 1110 Power
- URAL1353——DP——Milliard Vasya's Function
- 递推DP URAL 1081 Binary Lexicographic Sequence
- 记忆化搜索(DFS+DP) URAL 1223 Chernobyl’ Eagle on a Roof
- URAL 1464 Light
- URAL 1039 Anniversary Party 树形DP 水题