2 条题解

  • 0
    @ 2023-5-19 18:13:47

    享受 copycopy 的快乐

    #include <iostream>
    #include <stack>
    #include <cmath>
    #include <vector>
    #include <string.h>
    #include <queue>
    #include <stdio.h>
    #include <iomanip>
    #include <cstdio>
    #include <algorithm>
    #define LL long long
    #define double long double
    using namespace std;
    const int N = 3e1 + 10;
    const int INF = 0x3f3f3f3f;
    int a, b;
    char op;
    signed main()
    {
    	cin >> a >> op >> b;//按照题意输入
        int ans = 0;//答案
        if(op == '+')
        {
            ans = a + b;//计算答案
            if(ans != 1)//不是1
            {
                printf("steve has %d kuns\n", ans);//kuns
            }
            else
            {
                printf("steve has 1 kun\n");//kun
            }
        }
        //写完就能复制了(喜
        if(op == '-')
        {
            ans = a - b;
            if(ans != 1)
            {
                printf("steve has %d kuns\n", ans);
            }
            else
            {
                printf("steve has 1 kun\n");
            }
            //copy
        }
        if(op == '*')
        {
            ans = a * b;
            if(ans != 1)
            {
                printf("steve has %d kuns\n", ans);
            }
            else
            {
                printf("steve has 1 kun\n");
            }
            //copy
        }
        if(op == '/')
        {
            ans = a / b;
            if(ans != 1)
            {
                printf("steve has %d kuns\n", ans);
            }
            else
            {
                printf("steve has 1 kun\n");
            }
            //copy
        }
    	return 0;
    }
    
    • 0
      @ 2023-1-19 21:45:41

      按照题意模拟即可

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
          int a,b;
          char c;
          cin>>a>>c>>b;
          cout<<"steve has ";
          if(c=='+')cout<<a+b<<(a+b>1?" kuns":" kun");
          else if(c=='-')cout<<a-b<<(a-b>1?" kuns":" kun");
          else if(c=='*')cout<<a*b<<(a*b>1?" kuns":" kun");
          else cout<<a/b<<(a/b>1?" kuns":" kun");
          return 0;
      }
      
      • 1

      信息

      ID
      17
      时间
      1000ms
      内存
      512MiB
      难度
      6
      标签
      (无)
      递交数
      20
      已通过
      12
      上传者