poj1006-枚举

来源:互联网 发布:windows10引导ubuntu 编辑:程序博客网 时间:2024/06/04 01:25

#include<iostream>

using namespacestd;

int main(){

    int p, e, i, d, k;

    int ans, no;

    while(cin>>p>>e>>i>>d)

    {

        ++ no;

        if(p==-1 && e==-1 && i==-1 && d==-1)

            break;

        for(k = d +1; (k - p) % 23; k ++){

            for(; (k - e) %28; k += 23){

                for(; (k - i) %33; k += 23 *28){

                    cout<<"Case "<<no<<": the next triple peak occurs in "<<k - d<<" days."<<endl;

                }

            }

        }

    }

    return0;

}


原创粉丝点击