Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:哪错了?跑了好几遍

Posted by 3233313048 at 2016-05-20 22:34:00 on Problem 1006
In Reply To:哪错了?跑了好几遍 Posted by:0121410870719 at 2016-02-16 14:50:11
> #include<iostream>
> using namespace std;
> struct num {
> 	int a, b, c, d, t;
> };
> int main() {
> 	int a = 0, b = 0, c = 0, d = 0, f = 0;
> 	num all[300];
> 	while (!(a == -1 && b == -1 && c == -1 && d == -1)) {
> 		cin >> a >> b >> c >> d;
> 		all[f].a = a;
> 		all[f].b = b;
> 		all[f].c = c;
> 		all[f].d = d;
> 		f++;
> 	}
> 	f--;
> 	for (int i = 0; i < f;i++) {
> 		int e = c;
> 		a = all[i].a;
> 		b = all[i].b;
> 		c = all[i].c;
> 		d = all[i].d;
> 		a = a % 23;
> 		b = b % 28;
> 		c = c % 33;
> 		c += 33;
> 		while (!(c % 23 == a && c % 28 == b)) {
> 			c += 33;
> 		}
> 		while (c < d)
> 			c += e;
> 		all[i].t = c - d;
> 	}
> 	for (int i = 0; i < f; i++)
> 		while (all[i].t>21252)
> 			all[i].t -= 21252;
> 	for (int i = 0; i < f; i++)
> 		cout << "Case "<<i+1<<": the next triple peak occurs in "<< all[i].t <<" days." << endl;
> 	return 0;
> }
> 随手写的 有点丑 有点暴力。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator