题目链接:http://poj.org/problem?id=2000

题目大意:求N天得到多少个金币,第一天得到1个,第二、三天得到2个,第四、五、六天得到3个、、、、以此类推,得到第N天的金币数。

 #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main ()
{
int x,n,p;
while(cin>>n)
{
if (n==)
break;
x=p=;
int sum=;
while(x<=n)
{
for(int i=x;i<x+p&&i<=n;i++)
sum+=p;
x=x+p;
p++;
}
cout<<n<<" "<<sum<<endl;
}
return ;
}

poj 2000 Gold Coins的更多相关文章

  1. OpenJudge/Poj 2000 Gold Coins

    1.链接地址: http://bailian.openjudge.cn/practice/2000 http://poj.org/problem?id=2000 2.题目: 总Time Limit: ...

  2. poj 2000 Gold Coins(水题)

    一.Description The king pays his loyal knight in gold coins. On the first day of his service, the kni ...

  3. Gold Coins 分类: POJ 2015-06-10 15:04 16人阅读 评论(0) 收藏

    Gold Coins Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 21767   Accepted: 13641 Desc ...

  4. hdoj 2401 Baskets of Gold Coins

    Baskets of Gold Coins Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  5. HDOJ(HDU) 2401 Baskets of Gold Coins(数列、)

    Problem Description You are given N baskets of gold coins. The baskets are numbered from 1 to N. In ...

  6. Baskets of Gold Coins

    Baskets of Gold Coins Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  7. H - Gold Coins(2.4.1)

    H - Gold Coins(2.4.1) Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:3000 ...

  8. Gold Coins

    http://poj.org/problem?id=2000 #include<stdio.h> ; int main() { int coin[N]; ,j,k; j = ; k = ; ...

  9. POJ 3274 Gold Balanced Lineup

    Gold Balanced Lineup Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10924 Accepted: 3244 ...

随机推荐

  1. hibernate.cfg.xml的详细解释

    <!--标准的XML文件的起始行,version='1.0'表明XML的版本,encoding='gb2312'表明XML文件的编码方式-->                    < ...

  2. 在windows搭建react

    1.安装必须的软件 1.Python 2    注意勾选 Add python.exe to Path,选项,这样就可以在安装完成后,不用手动去添加环境变量    安装完,打开cmd.exe,输入py ...

  3. asp.net异步上传

    界面如下:

  4. Python 静态方法、类方法和属性方法

    Python 静态方法.类方法和属性方法 静态方法(staticmethod) staticmethod不与类或者对象绑定,类和实例对象都可以调用,没有自动传值效果,Python内置函数staticm ...

  5. YY的GCD 莫比乌斯反演

    ---题面--- 题解: $ans = \sum_{x = 1}^{n}\sum_{y = 1}^{m}\sum_{i = 1}^{k}[gcd(x, y) == p_{i}]$其中k为质数个数 $$ ...

  6. Android 打开照相机、获取相册图片、获取图片并裁减

    一.调用照相机 注:surfaceView在当Activity不在前台的时候,会被销毁(onPause方法之后,执行销毁方法)当Activity回到前台时,在Activity执行onResume方法之 ...

  7. POJ3907:Build Your Home——题解

    http://poj.org/problem?id=3907 题目大意:求多边形面积,结果四舍五入. ———————————————————— 多边形面积公式板子题. #include<cstd ...

  8. BZOJ2924 [Poi1998]Flat broken lines 【Dilworth定理 + 树状数组】

    题目链接 BZOJ2924 题解 题面有误..是\(45°\) 如果两个点间连线与\(x\)轴夹角在\(45°\)以内,那么它们之间连边 求最小路径覆盖 = 最长反链 由于\(45°\)比较难搞,我们 ...

  9. POJ.1287 Networking (Prim)

    POJ.1287 Networking (Prim) 题意分析 可能有重边,注意选择最小的边. 编号依旧从1开始. 直接跑prim即可. 代码总览 #include <cstdio> #i ...

  10. 51nod 1215 数组的宽度&poj 2796 Feel Good(单调栈)

    单调栈求每个数在哪些区间是最值的经典操作. 把数一个一个丢进单调栈,弹出的时候[st[top-1]+1,i-1]这段区间就是弹出的数为最值的区间. poj2796 弹出的时候更新答案即可 #inclu ...