2 条题解
-
-512213王宇石 (王宇石) LV 8 @ 2021-11-01 21:21:45
#include<bits/stdc++.h>
using namespace std;
int m,s,t;int main()
{
//freopen("escape.in","r",stdin);
//freopen("escape.out","w",stdout);
int t0=0;
int sum=0;
scanf("%d%d%d",&m,&s,&t);
int a=m/10;
if(60*a>=s&&a<=t)
{
printf("Yes\n");
if(s%60==0)
printf("%d\n",s/60);
else
printf("%d\n",s/60+1);
return 0;
}
if(t<=a)
{
printf("No\n%d\n",60*t);
return 0;
}
m=m-10*a;
m=m/2*2;
/* if((m==2||m==3||m==4||m==5)&&t>=a+3)
{
t=t-2;
t0=t0+2;
a=a+1;
m=0;
}
if((m==6||m==7||m==8||m==9)&&t>=a+2)
{
t=t-1;
t0=t0+1;
a=a+1;
m=0;
}*/
if((m==2||m==4)&&t>=a+3)
{
t=t-2;
t0=t0+2;
a=a+1;
m=m-2;
}
if((m==6||m==8)&&t>=a+2)
{
t=t-1;
t0=t0+1;
a=a+1;
m=m-6;
}
if(60*a>=s&&a<=t)
{
printf("Yes\n");
if(s%60==0)
printf("%d\n",s/60+t0);
else
printf("%d\n",s/60+1+t0);
return 0;
}
if(m==2&&t>=a+3)
{
t=t-2;
t0=t0+2;
a=a+1;
m=0;
}
if(m==6&&t>=a+2)
{
t=t-1;
t0=t0+1;
a=a+1;
m=0;
}
if(60*a>=s&&a<=t)
{
printf("Yes\n");
if(s%60==0)
printf("%d\n",s/60+t0);
else
printf("%d\n",s/60+1+t0);
return 0;
}
t=t-a;
t0=t0+a;
sum=60*a;
int smax=sum;
int t1=t/7,t2=t-t1*7;
smax=smax+t1*120+t2*17;
if(smax<s)
{
printf("No\n%d\n",smax);
return 0;
}
a=(s-sum)/120;
int b;
if(s-sum-a*120%17==0)
b=(s-sum-a*120)/17;
else
b=(s-sum-a*120)/17+1;
if(b>=7)
{
a=a+1;
b=0;
}
t0=t0+a*7+b;
printf("Yes\n%d\n",t0);
return 0;
} -
-72021-11-01 21:22:40@
#include<bits/stdc++.h>
using namespace std;
int m,s,t;int main()
{
//freopen("escape.in","r",stdin);
//freopen("escape.out","w",stdout);
int t0=0;
int sum=0;
scanf("%d%d%d",&m,&s,&t);
int a=m/10;
if(60*a>=s&&a<=t)
{
printf("Yes\n");
if(s%60==0)
printf("%d\n",s/60);
else
printf("%d\n",s/60+1)
return 0;
}
if(t<=a)
{
printf("No\n%d\n",60*t);
return 0;
}
m=m-10*a;
m=m/2*2;
/* if((m==2||m==3||m==4||m==5)&&t>=a+3)
{
t=t-2;
t0=t0+2;
a=a+1;
m=0;
}
if((m==6||m==7||m==8||m==9)&&t>=a+2)
{
t=t-1
t0=t0+1;
a=a+1;
m=0;
}*/
if((m==2||m==4)&&t>=a+3)
{
t=t-2;
t0=t0+2;
a=a+1;
m=m-2;
}
if((m==6||m==8)&&t>=a+2)
{
t=t-1;
t0=t0+1;
a=a+1;
m=m-6;
}
if(60*a>=s&&a<=t)
{
printf("Yes\n");
if(s%60==0)
printf("%d\n",s/60+t0);
else
printf("%d\n",s/60+1+t0);
return 0;
}
if(m==2&&t>=a)
{
t=t-2;
t0=t0+2;
a=a+1;
m=0;
}
if(m==6&&t>=a+2)
{
t=t-1;
t0=t0+1;
a=a+1;
m=0;
}
if(60*a>=s&&a<=t)
{
printf("Yes\n");
if(s%60==0)
printf("%d\n",s/60+t0);
else
print("%d\n",s/60+1+t0);
return 0;
}
t=t-a;
t0=t0+a;
sum=60*a;
int smax=sum;
int t1=t/7,t2=t-t1*7;
smax=smax+t1*120+t2*17;
if(smax<s)
{
printf("No\n%d\n",smax);
return 0;
}
a=(s-sum)/120;
int b;
if(s-sum-a*120%17==0)
b=(s-sum-a*120)/17;
else
b=(s-sum-a*120)/17+1;
if(b>=7)
{
a=a+1;
b=0;
}
t0=t0+a*7+b;
printf("Yes\n%d\n",t0);
return 0;
}
- 1