poj 2000 Gold Coins
来源:互联网 发布:知乎的盈利模式 论文 编辑:程序博客网 时间:2024/05/12 07:59
题目链接:http://poj.org/problem?id=2000
题目大意:求N天得到多少个金币,第一天得到1个,第二、三天得到2个,第四、五、六天得到3个、、、、以此类推,得到第N天的金币数。
1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 using namespace std; 5 int main () 6 { 7 int x,n,p; 8 while(cin>>n) 9 {10 if (n==0)11 break;12 x=p=1;13 int sum=0;14 while(x<=n)15 {16 for(int i=x;i<x+p&&i<=n;i++)17 sum+=p;18 x=x+p;19 p++;20 }21 cout<<n<<" "<<sum<<endl;22 }23 return 0;24 }
0 0
- POJ 2000 Gold Coins
- poj 2000 Gold Coins
- poj 2000 Gold Coins
- poj 2000 Gold Coins
- POJ 2000 - Gold Coins
- POJ 2000 Gold Coins
- POJ 2000 Gold Coins
- poj 2000 Gold Coins
- POJ-2000 Gold Coins
- Gold Coins POJ 2000
- POJ 2000 Gold Coins
- poj 2000 Gold Coins
- POJ 2000 Gold Coins
- POJ 2000 Gold Coins(模拟)
- poj 2000 Gold Coins(水题)
- POJ 2000 Gold Coins 水题
- Gold Coins - POJ 2000 水题
- [ACM] POJ 2000 Gold Coins
- 【算法】贪心算法(0-1背包问题)
- oracle wm_concat(column)函数的使用
- IOS CoreText.framework --- 段落样子CTParagraphStyle
- hdu 1016 Prime Ring Problem (素数环)
- hdu 1253 胜利大逃亡(简单题)
- poj 2000 Gold Coins
- Struts2整合EasyUi中的DataGird
- poj 1298 The Hardest Problem Ever
- poj 3751 时间日期格式转换
- 解读Unity中的CG编写Shader系列3——表面剔除与剪裁模式
- hdu 2000 ASCII码排序
- 窗口加载Bitmap
- 第3章 套接口编程简介
- hdu 2014 青年歌手大奖赛_评委会打分