题目描述:
-
给定一天是一周中的哪天,请问 n 天后是一周中的哪天?输入第一行包含一个整数 w,表示给定的天是一周中的哪天,w 为 1 到 6 分别表示周一到周六,w 为 7 表示周日。第二行包含一个整数 n。输出一行包含一个整数,表示 n 天后是一周中的哪天,1 到 6 分别表示周一到周六,7 表示周日。对于所有评测用例,1 <= n <= 1000000。
-
此题为签到题 一定要细心 不可马虎鸭!
-
我当时写的时候的WA代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main ()
{
ll w,n;
scanf("%lld%lld",&w,&n);
ll t=(w+n)%7;// 忽略了当t等于0的情况
printf("%lld\n",t);
return 0;
}
- 亲人们越是简单的题切不可大意
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main ()
{
ll w,n;
scanf("%lld%lld",&w,&n);
ll t=(w+n)%7;
if(t==0) pritnf("7");
else printf("%lld\n",t);
return 0;
}