谁帮我看看错哪了
查看原帖
谁帮我看看错哪了
1040211
WuZhouT楼主2023/7/14 18:07
#include <iostream>
using namespace std;
int upto(int a,int b)
{
	if(a%b==0)
	{
		return a/b;
	}
	else
	{
		return a/b+1;
	}
}
int main()
{
	int m,s,t,a=0;
	cin>>m>>s>>t;
	for(int x=t-1;x>=0;x--)
	{
		//cout<<"one for("<<t-x<<"):"<<endl;
		if(m>=10)
		{
			a+=60;
			//cout<<"do a magic"<<endl;
			m-=10;
		}
		else if(upto((10-m),4)<x+1&&upto((10-m),4)*17<60&&(s-a)/60<(s-a)/17)
		{
			//cout<<"wait"<<endl;
			m+=4;
		}
		else
		{
			//cout<<"walk"<<endl;
			a+=17;
		}
		if(a>=s)
		{
			t-=x;
			break;
		}
		//cout<<"now m:"<<m<<" a:"<<a<<endl;
	}
	if(a>=s)
	{
		cout<<"Yes"<<endl<<t;
	}
	else
	{
		cout<<"No"<<endl<<a;
	}
	
}
2023/7/14 18:07
加载中...