2 条题解

  • 1
    @ 2025-1-23 17:20:45
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int x,y;
    	cin>>x>>y;
    	if(x>y){
    		cout<<">";
    	}
    	else if(x<y){
    		cout<<"<";
    	}
    	if(x==y){
    		cout<<"=";
    	}
    	return 0;
    }
    

    记得给我点赞喔!!!

    • 0
      @ 2025-1-22 18:53:58

      这题很简单, 按题目要求来即可。如下:

      说明

      输入两个整数,比较它们的大小。若x>y,输出>;若x=yx=y,输出=;若x< y,输出<

      输入格式

      一行,包含两个整数xx和yy,中间用单个空格隔开。

      输出格式

      一个字符。若x>yx>y,输出 > ;若x=yx=y,输出 = ;若x< yx<y,输出 <

      #include<bits/stdc++.h>
      using  namespace  std;
      int  main(){
          long  long x,y;
          cin>>x>>y;
          if(x>y)  cout<<">";
          else  if(x<y)  cout<<"<";
          else  cout<<"=";
          return  0;
      }
      

      这题非这么写不行😕 long long可以换成int; 但不能写成: else if(x=y) cout<<"="; 太奇怪👀️ 。 下面是错误示范:

      #include<bits/stdc++.h>
      using  namespace  std;
      int  main(){
          int x,y;
          cin>>x>>y;
          if(x>y)  cout<<">";
          else  if(x<y)  cout<<"<";
          else  if(x=y)  cout<<"=";
          return  0;
      }
      

      喜欢点个赞!!!!!!!!! 虽然很简单👍 👍 😄 感谢!❤️

      • 1

      信息

      ID
      609
      时间
      1000ms
      内存
      128MiB
      难度
      4
      标签
      递交数
      60
      已通过
      30
      上传者