6 条题解

  • 1
    @ 2023-2-13 13:20:40

    这题就不用多说了吧

    • 1
      @ 2023-1-1 21:07:14

      判断一个数是正数、负数还是0,只需要看第一位就好了。

      #include<stdio.h>
      int main(){
          switch (getchar()) {
              case '-':
                  printf("negative");
                  return 0;
              case '0':
                  printf("zero");
                  return 0;
              default:
                  printf("positive");
                  return 0;
          }
          return 0;
      }
      
      • 1
        @ 2022-5-25 22:39:51
        #include<bits/stdc++.h>
        using namespace std;
        long long q,w,e,r,t,y,u,i,o,p,d,f,g,h,j,k,l,z,x,c,v,b,n,m;
        string s;
        long long a[100000],as[100000],asd[100000];
        char cc;
        double dd;
        int main()
        {
        	cin>>x;
        	if(x>0)
        	cout<<"positive";
        	if(x==0)
        	cout<<"zero";
        	if(x<0)
        	cout<<"negative";
            return 0;
        }
        
        • 0
          @ 2023-10-22 11:14:11
          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a;
              cin>>a;
              if (a == 0)
              {
                  cout<<"zero";
                  return 0;
              }
              if (a < 0)
              {
                  cout<<"negative";
                  return 0;
              }
              if (a > 0)
              {
                  cout<<"positive";
                  return 0;
              }
          }
          
          • 0
            @ 2023-1-8 7:59:04
            #include <bits/stdc++.h>
            
            using namespace std;
            
            int main() {
            	int n;
            	cin>>n;
            	if (n == 0) {
            		printf("zero");
            	} else if (n < 0) {
            		printf("negative");
            	} else {
            		printf("positive");
            	}
            	return 0;
            } 
            
            • 0
              @ 2022-7-4 23:00:03
              #include<iostream>
              #include<cstdio>
              using namespace std;
              int n;
              int main(){
              	cin>>n;
              	if(n>0) printf("positive\n");
              	if(n==0) printf("zero\n");
              	if(n<0) printf("negative\n");
              	return 0;
              }
              

              记录:https://www.luogu.com.cn/record/63710536

              • 1

              信息

              ID
              6847
              时间
              1000ms
              内存
              128MiB
              难度
              1
              标签
              (无)
              递交数
              63
              已通过
              46
              上传者