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

暴力大法好 32MS 测试数据结果可能有负的 贴代码

Posted by 476844427 at 2015-05-22 18:19:57 on Problem 1006
#include<stdio.h>
int t,g,z,d,num,tot;
int main()
{
  while(scanf("%d%d%d%d",&t,&g,&z,&d),t+g+z+d+4)
  {
   if(t==0&&g==0&&z==0)
   {
   num=21252;
   printf("Case %d: the next triple peak occurs in %d days.\n",++tot,num-d);
   continue;
   }
   for(int i=-15;i<=645;i++)
    {
     num=i*33+z;
     if((num-g)%28==0&&(num-t)%23==0&&(num-d)>0)
     {
     printf("Case %d: the next triple peak occurs in %d days.\n",++tot,num-d);
     break;
	 }
    }
  }
  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