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 ...
随机推荐
- 母牛的故事(hdoj 2018,动态规划递推,详解)
有一头母牛,它每年年初生一头小母牛.每头小母牛从第四个年头开始,每年年初也生一头小母牛.请编程实现在第n年的时候,共有多少头母牛? Sample Input2450Sample Output246 / ...
- linux网络编程——域名转换 gethostbyname与gethostbyaddr
域名转换 #include <netdb.h> struct hostent *gethostbyname(const char *name); 参数: name: 执行主机名的指针 返回 ...
- python whl模块安装方法
搞了半个小时可算是安装上去了 做法 ①先cmd输入Python看一下自己的Python是什么版本的,以及自己的平台,我这里是win32以及python3.6 ②然后去寻找合适的whl,注意cp就是版本 ...
- Win10中创建Hyper-V虚拟机
Win10虚拟机创建方法方法 1 开始菜单->所有应用->Windows系统->控制面板,程序->启用或关闭Windows功能,勾选Hyper-V下所有选项 如果Hyper-V ...
- convert images to a video (Ubuntu)
use =avconv= package e.g. to convert images (v_1.png, v_2.png ...) to 'velocity.mp4' >>> a ...
- C#装饰模式
using System;using System.Collections.Generic;using System.Text; namespace 装饰模式{ class Person ...
- Scala解析Json格式
Scala解析Json格式 代码块 Scala原生包 导入包 import scala.util.parsing.json._ def main(args: Array[String]): Unit ...
- 【网络流24题】最长k可重区间集问题(费用流)
[网络流24题]最长k可重区间集问题 [问题分析] 最大权不相交路径问题,可以用最大费用最大流解决. [建模方法] 方法1 按左端点排序所有区间,把每个区间拆分看做两个顶点<i.a>< ...
- Win32编程API 基础篇 -- 3.消息处理 根据英文教程翻译
消息处理 例子:窗口点击 好的,现在我们已经得到一个窗口了,但我们什么也做不了除了DefWindowProc()允许窗口大小被调整,最大最小化等...这不是很激动人心啊 在接下来的一小节中我将向你展示 ...
- [转] python 获取本机ip地址的两种实现方法
#!/usr/bin/python import socket import fcntl import struct def get_ip_address(ifname): s = socket.so ...