pku 1006

#include < iostream >

using namespace std;

//const a = 23,b = 28, c = 33;

/*for(int i = 1; i<20;i++)
{
if( (x*y*i)% k == 1 )
{
cout<<i*x*y<<endl;
break;
}
    }
*/

//中国剩余定理计算法
int main()
{
    
int cnt = 1,xx , yy , kk , ww ;
    
while(cin >> xx >> yy >> kk >> ww && xx != -1 && yy != -1 && kk != -1 && ww != -1)
    
{
        
int daan = 0;    
        
        daan 
= (xx * 5544 + yy*14421 +kk*1288 - ww + 21252 ) % 21252;
        
        
if!daan )
            daan 
= 21252;
         cout 
<< "Case " << cnt++ << ": the next triple peak occurs in " << daan << " days." << endl;
        
    }

    
return 0;
}

posted on 2008-08-06 14:50 wang 阅读(84) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理


导航

<2026年6月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿

文章档案

相册

搜索

最新评论