题解 | #开学?#
开学?
https://www.nowcoder.com/practice/9cc35bd0754f4feca18e10e57c672467
#include <stdio.h> int main() { int X=0,N=0; scanf("%d%d",&X,&N); //分两种讨论 //1、一是两个数相加小于或等于7 //2、二是大于七的情况 if(X+N<=7) { int sum=X+N; printf("%d",sum); } if(X+N>7) { while((X+N)%7!=0) { int num=(X+N)%7; printf("%d",num); break; } while((X+N)%7==0) { int num1=7;//等于0为星期天,赋值为7 printf("%d",num1); break; } } return 0; }