3 条题解

  • 1
    @ 2025-10-28 13:57:52
    #include <stdio.h>
    #include <iostream>
    using std :: cin;
    int a[1997], i, cnt, ans;;
    int main()
    {
        while(cin >> a[++ i])
        	ans += a[i], cnt ++;
        i = 1;
        while(i < cnt)
        	printf("%d+", a[i ++]);
        printf("%d=%d\n", a[i], ans);
        return 0;
    }
    
    • 0
      @ 2024-12-14 16:48:46
      #include <bits/stdc++.h>
      using namespace std;
      
      int main()
      {
          int n[10005], ans = 0, i = 1, cnt = 0;
          char a;
      	while(cin >> n[i] >> a)
          {
              ans += n[i++];
              cnt++;
          }
          for(int i = 1; i <= cnt; i++)
          {
              cout << n[i];
              if(i != cnt)
              {
                  cout << "+";
              }
              else
              {
                  cout << "=";
              }
          }
          cout << ans << endl;
      	return 0;
      }
      
      • -1
        @ 2022-12-5 9:44:31

        这不是循环题吗

        #include <iostream>
        #include <stack>
        #include <cmath>
        #include <vector>
        #include <string.h>
        #include <queue>
        #include <stdio.h>
        #include <iomanip>
        #include <cstdio>
        #include <algorithm>
        #define int long long
        using namespace std;
        const int N = 1e5 + 10;
        const int INF = 0x3f3f3f3f;
        signed main()
        {
            int n[N], ans = 0, i = 1, cnt = 0;
            char a;
        	while(cin >> n[i] >> a)
            {
                ans += n[i++];//算得数
                cnt++;//为循环做准备
            }
            for(int i = 1; i <= cnt; i++)
            {
                cout << n[i];//输出数据
                if(i != cnt)//等号判断
                {
                    cout << "+";//加号
                }
                else
                {
                    cout << "=";//等号
                }
            }
            cout << ans << endl;
        	return 0;
        }
        
        • 1

        信息

        ID
        1182
        时间
        1000ms
        内存
        128MiB
        难度
        4
        标签
        递交数
        138
        已通过
        62
        上传者