⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3026226_ac_30ms_380k.cpp

📁 pku acm 1006的源代码
💻 CPP
字号:
#include <iostream>
#include <fstream>
using namespace std;
typedef struct input
{
	int m_physical;
	int m_emotional;
	int m_intellectual;
	int m_givenDate;
}Case;
int main()
{
	Case Store[10000];
	int i=0,j=0,NUM,physical,emotional,intellectual,givenDate,result;
	while(cin>>physical>>emotional>>intellectual>>givenDate)
	{
		if(physical==-1 && emotional==-1 && intellectual==-1 && givenDate==-1)	
			break;
		Store[i].m_physical=physical;
		Store[i].m_emotional=emotional;
		Store[i].m_intellectual=intellectual;
		Store[i].m_givenDate=givenDate;
		i++;
	}
	NUM=i;
	for(i=0;i<NUM;i++)
	{
		result=physical=Store[i].m_physical;
		emotional=Store[i].m_emotional;
		intellectual=Store[i].m_intellectual;
		j=0;
		while(true)
		{
			result+=23;
			j++;
			if((result-emotional)%28==0 && (result-intellectual)%33==0)
				break;
		}
		if(result-Store[i].m_givenDate>21252 )
		{
			cout<<"Case "<<i+1<<": the next triple peak occurs in "<<(result-Store[i].m_givenDate)%21252<<" days."<<endl;
		}
		else if(result-Store[i].m_givenDate<=0)
		{
			cout<<"Case "<<i+1<<": the next triple peak occurs in "<<result-Store[i].m_givenDate+21252<<" days."<<endl;
		}
		else 
		{
			cout<<"Case "<<i+1<<": the next triple peak occurs in "<<result-Store[i].m_givenDate<<" days."<<endl;
		}

	}

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -