4 solutions

  • 2
    @ 2026-2-23 11:25:10
    #include<bits/stdc++.h> 
    using namespace std;
    int main()
    {
    	int x,n;
    	cin>>x>>n;
    	int t=(x+n)%7;
    	if(t==0) t=7;
    	cout<<t; 
    	return 0;
    }
    
    
    
    • 1
      @ 2026-8-22 19:31:49
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int a,b;//定义a和b分别代表初始星期和差多少天考试 
      	cin>>a>>b;//输入ing...... 
      	int i=a+b;//定义i=初始星期加上差多少天考试 
      	if(i>7) {//判断是否比7大  
      		if(i%7==0)//再次判断是否是7的倍数防止输出0而不是7 
      			i=7;//把i强制变成7 
      		else
      			i%=7;}//如果不是7的倍数则将>=8的数全变成1~7的数 
      	cout<<i;//输出ing...... 
      	return 0;
      }
      //2026/8/22  19:30发布,当前有效!
    • 1
      @ 2026-1-25 13:22:02
      #include<bits/stdc++.h>
      using namespace std;int main(){int a,b;cin>>a>>b;cout<<(a+b-1)%7+1;}
      
      • -4
        @ 2025-11-27 11:54:18

        C++ :

        #include<bits/stdc++.h> 
        using namespace std;
        int main()
        {
        	int x,n;
        	cin>>x>>n;
        	int t=(x+n)%7;
        	if(t==0) t=7;
        	cout<<t; 
        	return 0;
        }
        
        
        • 1

        Information

        ID
        16
        Time
        1000ms
        Memory
        128MiB
        Difficulty
        6
        Tags
        # Submissions
        65
        Accepted
        20
        Uploaded By