叫我投投


私信TA

用户名:dnj0822

访问量:12117

签 名:

宇宙机天下第一

等  级
排  名 221
经  验 6116
参赛次数 0
文章发表 26
年  龄 0
在职情况 学生
学  校 肇庆学院
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include<stdio.h>
int count=0; 
int cishu=0;
int n;
int nextCourse(int course)
{
  
 if(course==1)
 {
//  printf("政");
  ++count;
  if(count==n)
  { 
   --count; 
   ++cishu;
   cishu=cishu%7654321;
   return 0;
  }
  else
   nextCourse(2);
  
  --count; 
  return 0;
 }
  
 if(course==4)
 {
//  printf("综"); 
  ++count;
  if(count==n)
  { 
   --count; 
   ++cishu;
   cishu=cishu%7654321;
   return 0;
  }
  else
   nextCourse(3);
  --count;
  return 0;
 }
  
 if(course==2)
 {
//  printf("历");
  ++count;
  if(count==n)
  { 
   --count; 
   ++cishu;
   cishu=cishu%7654321;
   return 0;
  }
  else
  {
   nextCourse(1);nextCourse(3);
  }
  
  --count;
  return 0;
 }
  
 if(course==3)
 {
//  printf("地");
  ++count;
  if(count==n)
  { 
   --count; 
   ++cishu;
   cishu=cishu%7654321;
   return 0;
  }
  else
  {
   nextCourse(2);nextCourse(4);
  }
  --count;
  return 0;
 }
  
}

int main()
{
 
 scanf("%d",&n);
// 1:政治,2:历史,3:地理,4:综合 
 nextCourse(1);
 printf("%d",cishu%7654321);
    return 0;
}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区