ZOJ 1110
来源:互联网 发布:ae软件中文版下载 编辑:程序博客网 时间:2024/06/06 21:13
Dick is 12 years old. When we say this, we mean that it is at least twelve and not yet thirteen years since Dick was born.
Dick and Jane have three pets: Spot the dog, Puff the Cat, and Yertle the Turtle. Spot was s years old when Puff was born; Puff was p years old when Yertle was born; Spot was y years old when Yertle was born. The sum of Spot's age, Puff's age, and Yertle's age equals the sum of Dick's age (d) and Jane's age (j). How old are Spot, Puff, and Yertle?
Each input line contains four non-negative integers: s, p, y, j. For each input line, print a line containing three integers: Spot's age, Puff's age, and Yertle's age. Ages are given in years, as described in the first paragraph.
Sample Input
5 5 10 95 5 10 105 5 11 10
Output for Sample Input
12 7 213 7 213 7 2
按题意枚举就能过……T_T
#include<stdio.h>int main(){ int s,p,y,J; while(~scanf("%d%d%d%d",&s,&p,&y,&J)) { int S,P,Y; for(int i=0;i<100;i++) { Y=i; for(int j=i+p;j<100;j++) { P=j; for(int k=j+s;k<100;k++) { S=k; if((S-P==s||S-P==s+1)&&(P-Y==p||P-Y==p+1)&&(S-Y==y||S-Y==y+1)&&(S+P+Y==12+J)) { printf("%d %d %d\n",S,P,Y); break; } } } } }}
- ZOJ 2104 ZOJ 1110
- zoj 1110
- ZOJ 1110
- ZOJ-1110
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- 数学公式+矩阵快速幂 hdu-4565 So Easy!
- getting start with storm 翻译 第四章 part-3
- USB系统基本概念
- 创建XWindow全屏窗口(Linux可视化编程)
- 关于SharedPreferences不能读到刚修改的数据
- ZOJ 1110
- java中重命名,移动文件
- eclipse自动提示+自动补全
- 条件变量
- hello
- oracle中的exists 和not exists 用法
- onCreateOptionsMenu与onCreateContextMenu的区别?
- 开发者制作图形图表所需的11款JS工具包
- 如何比较两个文本的相似度