2 条题解

  • 18
    @ 2024-5-26 16:55:23

    点赞拿答案

    #include <bits/stdc++.h>
    using namespace std;
    int c[30],v[30];
    int main()
    {
        int n,sum = 0;
        cin >> n;
        for (int i = 1;i <= n;i++) cin >> c[i];
        for (int i = 1;i <= n;i++) cin >> v[i];
        for (int i = 1;i <= n;i++)
        {
            if (v[i] > c[i])
            {
                 sum += (v[i] - c[i]);
            }
        }
        cout << sum;
        return 0;
    }
    

    下面那哥们虽然来的早,但还要稍作修改,我这个直接能用👍 🚀️

    • 5
      @ 2024-3-19 18:50:19
      #include <bits/stdc++.h>
      using namespace std;
      
      int c[25],v[25];
      
      int main()
      {
      int n,sum = 0;
      cin >> n;
      for (int i = 1;i <= n;i++) cin >> c[i];
      for (int i = 1;i <= n;i++) cin >> v[i];
      for (int i = 1;i <= n;i++)
      if (v[i] > c[i])
      sum += (v[i] - c[i]);
      cout << sum;
      return 0;
      }
      • 1

      信息

      ID
      2069
      时间
      1000ms
      内存
      256MiB
      难度
      8
      标签
      递交数
      5325
      已通过
      665
      上传者