Baskets of Gold Coins
Baskets of Gold Coins
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1862 Accepted Submission(s): 1108
are given N baskets of gold coins. The baskets are numbered from 1 to
N. In all except one of the baskets, each gold coin weighs w grams. In
the one exceptional basket, each gold coin weighs w-d grams. A wizard
appears on the scene and takes 1 coin from Basket 1, 2 coins from Basket
2, and so on, up to and including N-1 coins from Basket N-1. He does
not take any coins from Basket N. He weighs the selected coins and
concludes which of the N baskets contains the lighter coins. Your
mission is to emulate the wizard's computation.
input file will consist of one or more lines; each line will contain
data for one instance of the problem. More specifically, each line will
contain four positive integers, separated by one blank space. The first
three integers are, respectively, the numbers N, w, and d, as described
above. The fourth integer is the result of weighing the selected coins.
N will be at least 2 and not more than 8000. The value of w will be at most 30. The value of d will be less than w.
each instance of the problem, your program will produce one line of
output, consisting of one positive integer: the number of the basket
that contains lighter coins than the other baskets.
10 25 8 1045
8000 30 12 959879400
10
50
#include<stdio.h>
#include<string.h>
int main(){
int n,w,d,sum;
while(~scanf("%d%d%d%d",&n,&w,&d,&sum)){
int x=w*((n-+)*(n-)/)-sum;
if(x==)printf("%d\n",n);
else printf("%d\n",x/d);
}
return ;
}
Baskets of Gold Coins的更多相关文章
- 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_暴力
Problem Description You are given N baskets of gold coins. The baskets are numbered from 1 to N. In ...
- 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: ...
- 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天的金币数. ...
- Gold Coins
http://poj.org/problem?id=2000 #include<stdio.h> ; int main() { int coin[N]; ,j,k; j = ; k = ; ...
随机推荐
- Almost Prime
Description Almost Prime time limit per test: 2 seconds memory limit per test: 256 megabytes input: ...
- 【翻译】MVC Music Store 教程-概述(二)
1. 文件->新建项目 软件安装 此篇将从运用免费的Visual Web Developer 2010Express来创建ASP.NET MVC3开始,逐步的添加一些功能来创建一个完整的应用程序 ...
- 开源代码——Crouton
开源代码——Crouton 一个可随意定位置的带色Toast——开源代码Crouton的简单使用 今天在公司要求的代码中,要求显示的提示能够更加具有多样化,而不是简单的Toast字样,第一想法肯定 ...
- JLINK烧写BIN文件到nand、norflash、SDRAM
1. 简要说明 JLink的调试功能.烧写Flash的功能都很强大,但是对于S3C2410.S3C2440的Flash操作有些麻烦:烧写Nor Flash时需要设置SDRAM,否则速率很慢:烧写Nan ...
- QT 线程池 + TCP 小试(一)线程池的简单实现
*免分资源链接点击打开链接http://download.csdn.net/detail/goldenhawking/4492378 很久以前做过ACE + MFC/QT 的中轻量级线程池应用,大概就 ...
- 图像处理库的比较:OpenCV,FreeImage,CImg,CxImage
1.对OpenCV 的印象:功能十分的强大,而且支持目前先进的图像处理技术,体系十分完善,操作手册很详细,手册首先给大家补计算机视觉的知识,几乎涵盖了近10年内的主流算法: 然后将图像格式和矩阵运算, ...
- CocoaPods的安装及安装出现问题的处理
ocoaPods安装分两步:第一步.修改本机的Ruby环境:第二步.安装. 第一步:步骤1.打开终端输入 gem sources -l 查看本机的Ruby环境:若显示“https://ruby ...
- 此证书的签发者无效Missing iOS Distribution signing identity问题解决
问题描述 今天准备打包上传AppStore,结果Xcode报以下错误:Missing iOS Distribution signing identity for XXXXXX 查看证书后发现,Deve ...
- javaEE servlet获取jsp内置对象
既然jsp和servlet是等价的,在jsp中能够使用内置对象,那么在servlet中也能够使用. 1.获得out对象 能够使用例如以下代码获得out对象: import java.io.PrintW ...
- Python学习笔记(十五):类基础
以Mark Lutz著的<Python学习手册>为教程,每天花1个小时左右时间学习,争取两周完成. --- 写在前面的话 2013-7-24 23:59 学习笔记 1,Python中的大多 ...