Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大水题,暴力可过#include <iostream> #include <stdio.h> using namespace std; int main() { while(1){ int temp; scanf("%d", &temp); if(temp == 0) { int temp1, temp2; scanf("%d%d", &temp1, &temp2); break; } int minC; int cycle[110]; bool state[120] = {0}; int num = 1; cycle[0] = temp; minC = temp; while(1){ int tmp; scanf("%d", &tmp); if(tmp == 0) break; if(state[tmp]) continue; cycle[num] = tmp; state[tmp] = 1; num ++; if(tmp < minC) minC = tmp; } int mmm = -1; for(int i = 2 * minC; i <= 18000; i++){ bool keyi = true; for(int j = 0; j < num; j++){ if(i % (2*cycle[j]) >= cycle[j]-5){ keyi = false; break; } } if(keyi){ mmm = i; break; } } if(mmm == -1){ printf("Signals fail to synchronise in 5 hours\n"); } else{ int hour = mmm/3600, minute = (mmm%3600)/60, second = mmm%60; printf("0%d:", hour); if(minute < 10) printf("0"); printf("%d:", minute); if(second < 10) printf("0"); printf("%d\n", second); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator