九度OJ 1036:Old Bill
来源:互联网 发布:yessat 知乎 编辑:程序博客网 时间:2024/05/16 16:13
题目描述:
Among grandfather’s papers a bill was found.
72 turkeys
The total number of turkeys, N, is between 1 and 99, including both. The total price originally consisted of five digits, but we can see only the three digits in the middle. We assume that the first digit is nonzero, that the price of one turkeys is an integer number of dollars, and that all the
turkeys cost the same price.
Given N, X, Y, and Z, write a program that guesses the two faded digits and the original price. In case that there is more than one candidate for the original price, the output should be the most expensive one. That is, the program is to report the two faded digits and the maximum price per turkey for the turkeys.
输入:
The first line of the input file contains an integer N (0
#include <cstdio>using namespace std;int main(){ int n,x,y,z; while(scanf("%d",&n) != EOF){ scanf("%d%d%d",&x,&y,&z); bool flag = true; for(int i = 9;i > 0;i--){ for(int j = 9;j >= 0;j--){ int tmp = 10000*i + 1000*x + 100*y + 10*z + j; if(tmp % n == 0){ printf("%d %d %d\n",i,j,tmp/n); flag = false; break; } } if(flag == false)break; } if(flag == true)printf("0\n"); }}
- 九度OJ题目1036:Old Bill
- 九度oj-1036-Old Bill
- 九度OJ-1036:Old Bill
- 九度oj-1036-old bill
- 九度OJ 1036:Old Bill
- 九度OJ题目1036:Old Bill
- 九度OJ 1036 Old Bill (模拟)
- 九度OnlineJudge之1036:Old Bill
- 九度OJ 1036:Old Bill (老比尔) (基础题)
- 题目1036 Old Bill 九度Online Judge
- 题目1036:Old Bill
- 题目1036:Old Bill
- 题目1036:Old Bill
- 题目1036:Old Bill
- 题目1036:Old Bill
- old bill
- zoj 2679 Old Bill
- zoj 2679 Old Bill
- Android Activity四种启动模式
- 单元测试需要切换数据源和继承AbstractTransactionalJUnit4springContextTests类冲突
- android工具测试-常见问题及解决办法
- java中日期格式化
- 五个非常重要的移动Web内容适应设计理念
- 九度OJ 1036:Old Bill
- Laravel 实用packagist
- MySql查询当年1-12月数据
- maven +SpringBoot+restful+mySql
- 卢俊卿谈从失衡走向均衡的幸福城市
- C++学习笔记(三)
- 如何降低运放电路中的电源噪声
- Android端通过Usb建立Socket通讯(实时发送视频数据)
- 华为交换机con0,telnet,vlan,trunk,access配置案例