Gold Coins
http://poj.org/problem?id=2000
#include<stdio.h>
const int N=;
int main()
{
int coin[N];
long long n,i = ,j,k;
j = ;
k = ;
while (i < )
{
if (k < j)
{
coin[i++] = j;
k++;
}
if (k >= j)
{
k = ;
j++;
} }
while(~scanf("%lld",&n)&&n)
{
long long scoin = ;
for (i = ; i <= n; i ++)
scoin += coin[i];
printf("%lld %lld\n",n,scoin);
}
return ;
}
Gold Coins的更多相关文章
- Gold Coins 分类: POJ 2015-06-10 15:04 16人阅读 评论(0) 收藏
Gold Coins Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21767 Accepted: 13641 Desc ...
- OpenJudge/Poj 2000 Gold Coins
1.链接地址: http://bailian.openjudge.cn/practice/2000 http://poj.org/problem?id=2000 2.题目: 总Time Limit: ...
- hdoj 2401 Baskets of Gold Coins
Baskets of Gold Coins Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- 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 ...
- Baskets of Gold Coins
Baskets of Gold Coins Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- H - Gold Coins(2.4.1)
H - Gold Coins(2.4.1) Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:3000 ...
- poj 2000 Gold Coins(水题)
一.Description The king pays his loyal knight in gold coins. On the first day of his service, the kni ...
- poj 2000 Gold Coins
题目链接:http://poj.org/problem?id=2000 题目大意:求N天得到多少个金币,第一天得到1个,第二.三天得到2个,第四.五.六天得到3个....以此类推,得到第N天的金币数. ...
- Baskets of Gold Coins_暴力
Problem Description You are given N baskets of gold coins. The baskets are numbered from 1 to N. In ...
随机推荐
- UVA - 1601 The Morning after Halloween (双向BFS&单向BFS)
题目: w*h(w,h≤16)网格上有n(n≤3)个小写字母(代表鬼).要求把它们分别移动到对应的大写字母里.每步可以有多个鬼同时移动(均为往上下左右4个方向之一移动),但每步结束之后任何两个鬼不能占 ...
- KMP瞎扯一下
什么是KMP KMP俗称看毛片算法,是高效寻找匹配字串的一个算法 百度百科 KMP算法是一种改进的字符串匹配算法,由D.E.Knuth,J.H.Morris和V.R.Pratt同时发现,因此人们称它为 ...
- 2.6 访问 Shell 脚本的参数
所谓的位置参数(positional parameters)指的也就是Shell脚本的命令行参数(command-line arguments).在Shell函数里,它们同时也可以是函数的参数 ...
- springcloud(十一):熔断聚合监控Hystrix Turbine
springcloud(十一):熔断聚合监控Hystrix Turbine
- [bzoj1070][SCOI2007]修车[ 网络流]
把每个工人拆成N个点.记为A[i,j]表示第i个工人修倒数第j辆车.每个车跟所有N*M个工人拆出的点连边.流量为1,费用为$time[i,j]*k$.源和每辆车连边,N*M个点和汇连边,流量都为1,费 ...
- solr合并集合
当需要合并两个不同项目或者是多个分开配置的服务器时,你既可以使用lucene-misc里面的IndexMergeTool工具,也可以使用CoreAdminHandler. 要合并索引,必须满足如下要求 ...
- 0213微信ZABBIX报警
简介 微信作为日常使用最频繁的工具,因此希望将微信接入zabbix报警. 微信企业号 1.申请微信企业号 申请后,请在“我的企业”页面下记录企业号的CorpID 2.添加通讯录 部门添加完成后,根据实 ...
- The Evaluation of Determinant(求行列式mod一个数的值)
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #i ...
- HDU——4738 Caocao's Bridges
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 24、Java并发性和多线程-信号量
以下内容转自http://ifeve.com/semaphore/: Semaphore(信号量) 是一个线程同步结构,用于在线程间传递信号,以避免出现信号丢失(译者注:下文会具体介绍),或者像锁一样 ...