4 条题解

  • 1
    @ 2025-2-11 11:15:33
    #include<bits/stdc++.h>
    #define yy return 0;
    using namespace std;
    int main(){
        int n,k,s=0;
        scanf("%d %d",&n,&k);
        for(int i=1;i<=k;i++)
        {
            if(n!=6 && n!=7) s+=250;
            if(n==7) n=1;
            else n++;
        }
        printf("%d",s);
        yy
    }
    • 0
      @ 2025-3-31 14:26:26

      import java.util.Scanner;

      public class Main2 {

      public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
      
          //定义一个数组表示一周
          int []weekArr = {1,2,3,4,5,6,7};
      
          //定义x表示起始是周几
          int x = sc.nextInt() - 1;
      
          //定义n表示要走的天数
          int n = sc.nextInt();
      
      
          //定义总共走了的距离
          int sumDistance = 0;
      
          while (n > 0) {
      
              //判断是走还是休息
              sumDistance += isWalk(x, weekArr);
      
              //星期数加一
              x++;
      
              //判断星期数是否大于7
              if (x + 1 > 7) {
                  x = 0;
              }
      
      
      
              //天数减一
              n--;
          }
      
          //输出总共走了的距离
          System.out.println(sumDistance);
      }
      public static int isWalk (int x, int[] weekArr) {
          if (weekArr[x] == 6 || weekArr[x] == 7) {
              return 0;
          } else {
              return 250;
          }
      }
      

      }

      • 0
        @ 2025-3-25 21:45:06
        using namespace std;
        const int N = 33;
        int q[N];
        int main()
        {   
            bool flag = false;
            int x,n,sum = 0;
            cin >> x >> n;
            while (n)
            {
        
                if ((x % 7) >= 1 && x % 7 < 6 && x % 7 != 0)
                {
                    sum += 250;
                }
                x++;
                n--;
            }
            cout << sum;
        }
        
        
        • -2
          @ 2024-12-5 20:03:55

          #include using namespace std; //AC int main() { int x, n; cin >> x >> n; cout << 250 * (n - (x + n - 1) / 7 - (x + n) / 7 + (x == 7 ? 1 : 0)); return 0; }

          • 1

          信息

          ID
          5482
          时间
          1000ms
          内存
          125MiB
          难度
          1
          标签
          (无)
          递交数
          526
          已通过
          226
          上传者