52 条题解

  • 92
    @ 2022-7-15 23:36:26

    这题就是无脑狂写if语句 突然发现Ctrl+CV 是真香😄

    #include <bits/stdc++.h> 
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        if(n >= 10000 and n < 99999)
        {
            cout << "wan" << endl;
        }
        if(n >= 100000 and n < 999999)
        {
            cout << "shi wan" << endl;
        }
        if(n >= 1000000 and n < 9999999)
        {
            cout << "bai wan" << endl;
        }
        if(n >= 10000000 and n < 99999999)
        {
            cout << "qian wan" << endl;
        }
        if(n >= 100000000 and n < 999999999)
        {
            cout << "yi" << endl;
        }
        if(n >= 1000000000 and n < 9999999999)
        {
            cout << "shi yi" << endl;
        }
        return 0;
    }
    

    编码不易😕,点赞走起👀️
    记得点赞再抱走奥😄

    • @ 2022-7-18 21:16:17

      。。。。。。

    • @ 2022-7-18 21:16:58

      @ 没有别的方法?

    • @ 2022-8-3 17:04:03

      假如输入是99999,会发生啥呢? 首先第一个 n < 99999; 漂亮,正好不在范围; 剩下的更不用提了;

    • @ 2022-8-4 19:22:37

      @ hh,也是

    • @ 2022-8-21 14:48:30

      帮你改了一下

      #include <bits/stdc++.h> 
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          if(n >= 10000 and n < 99999)
          {
              cout << "wan" << endl;
          }
          if(n >= 100000 and n < 999999)
          {
              cout << "shi wan" << endl;
          }
          if(n >= 1000000 and n < 9999999)
          {
              cout << "bai wan" << endl;
          }
          if(n >= 10000000 and n < 99999999)
          {
              cout << "qian wan" << endl;
          }
          if(n >= 100000000 and n < 999999999)
          {
              cout << "yi" << endl;
          }
          if(n >= 1000000000 and n < 9999999999)
          {
              cout << "shi yi" << endl;
          }
          return 0;
      }
      
    • @ 2022-8-26 14:07:23

      @c++语法警告一次!&&

    • @ 2022-8-27 11:12:27

      你把它改成这样,写一个“=”的位置不就有了吗?

      #include <bits/stdc++.h> 
      using namespace std;
      int main(){
          int n;
          cin >> n;
          if(n >= 10000 and n <= 99999)cout << "wan";
          if(n >= 100000 and n <= 999999)cout << "shi wan";
          if(n >= 1000000 and n <= 9999999)cout << "bai wan";
          if(n >= 10000000 and n <= 99999999)cout << "qian wan";
          if(n >= 100000000 and n <= 999999999)cout << "yi";
          if(n >= 1000000000 and n<=9999999999)cout << "shi yi";
          return 0;
      }
      
    • @ 2022-8-27 11:13:27

      and和&&意思一样呀?@

    • @ 2022-8-29 17:07:52

      uhhh。。。

    • @ 2022-9-1 22:06:42

      👍 👍 👍 👍 👍 点赞666666666

    • @ 2022-9-2 17:23:07

      dnndndnd

    • @ 2022-9-5 16:24:34

      #incude <iostream> using namespace std; int main() { long long n; cin >> n; if (n <= 10000) { cout << "wan"; } else if (n <= 100000) { cout << "shi wan"; } else if (n <= 1000000) { cout << "bai wan"; } else if (n <= 10000000) { cout << "qian wan"; } else if (n <= 10000000) { cout << "yi"; } else { cout << "shi yi"; } return 0; }@

    • @ 2023-6-24 10:37:45

      你这种一看就是纸上谈兵,没点经验,and和&&通用,or和||通用@

    • @ 2023-8-5 14:54:49

      这么火呀。。。。。。 《关于这段代码获得了42个赞和<编码不易😕,点赞走起👀️记得点赞再抱走奥😄>的两件事》

    • @ 2023-8-5 15:09:31

      /user/20302
      《关于《关于《关于《关于《关于《关于@hetao390640这件事》这件事》这件事》这件事》这件事》这件事》

    • @ 2023-8-16 17:07:09

      如果输一个9999999999就不行了吧

    • @ 2023-8-18 8:44:49

      <=

    • @ 2023-8-23 10:19:20

      else if ( )也行

    • @ 2023-8-26 17:11:15

      啊对对对@

    • @ 2023-9-3 18:57:09

      @ &&和end一样啊

    • @ 2023-9-8 21:08:34

    • @ 2023-11-12 19:00:12

      用long long也可以

    • @ 2024-3-22 23:52:35

      最好用long long类型的,因为你输入的数会超过int的范围,也就是10的9次方

    • @ 2024-6-16 18:35:33

      `cpp

      using namespace std;
      int main()
      {
          string a;
          getline(cin, a);
          if (a.size() == 5) cout << "wan";
          else if (a.size() == 6) cout << "shi wan";
          else if (a.size() == 7) cout << "bai wan";
          else if (a.size() == 8) cout << "qian wan";
          else if (a.size() == 9) cout << "yi";
          else cout << "shi yi";
          return 0;
      }
      
      
  • 29
    @ 2022-8-9 20:22:02

    各位观众姥爷们,来吧,我先讲讲题目,可以用string型字符串数组,然后用a.size()来判断几位数,然后用几个分支语句即可。比陈元杰简单,看看吧~

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        string a;
        getline(cin, a);
        if (a.size() == 5) cout << "wan";
        else if (a.size() == 6) cout << "shi wan";
        else if (a.size() == 7) cout << "bai wan";
        else if (a.size() == 8) cout << "qian wan";
        else if (a.size() == 9) cout << "yi";
        else cout << "shi yi";
        return 0;
    }
    

    最后,点个赞吧~~~~写个评论吧

  • 7
    @ 2023-8-5 14:39:59

    由于我学过的知识有限,只想出了这种死算方法。 如果要用这种方法,建议你们使用复制粘贴。:command C + command V , Windows:ctrl C + ctrl V

    #include <iostream>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        if (n < 100000)
        {
            cout << "wan" << endl;
        }
        else if (n < 1000000)
        {
            cout << "shi wan" << endl;
        }
        else if (n < 10000000)
        {
            cout << "bai wan" << endl;
        }
        else if (n < 100000000)
        {
            cout << "qian wan" << endl;
        }
        else if (n < 1000000000)
        {
            cout << "yi" << endl;
        }
        else
        {
            cout << "shi yi" << endl;
        }
        return 0;
    }
    

    如果你们喜欢,可以点赞然后复制哟丶(^u^)—👍

  • 3
    @ 2023-12-2 18:56:18

    见识一下粗暴代码(非抄袭)

    #include<iostream>
    using namespace std;
    int main()
    {
        int a;
        cin>>a;
        if(a/10000<=9)
        {
            cout<<"wan";
        }
        else if(a/100000<=9)
        {
            cout<<"shi wan";
        }
        else if(a/1000000<=9)
        {
            cout<<"bai wan";
        }
        else if(a/10000000<=9)
        {
            cout<<"qian wan";
        }
        else if(a/100000000<=9)
        {
            cout<<"yi";
        }
        else if(a/1000000000<=9)
        {
            cout<<"shi yi";
        }
        return 0;
    }
    

    这个代码比较适合初学者。 制作不易,求点赞👍

    • 3
      @ 2023-8-16 10:41:57
      #include <iostream>
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          if(n / 100000 > 0)
          {
              if(n / 1000000 > 0)
              {
                  if(n / 10000000 > 0)
                  {
                      if(n / 100000000 > 0)
                      {
                          if(n / 1000000000 > 0)
                          {
                              cout << "shi yi";
                          }
                          else
                          {
                              cout << "yi";
                          }
                      }
                      else
                      {
                          cout <<"qian wan";
                      }
                  }
                  else
                  {
                      cout << "bai wan";
                  }
              }
              else
              {
                  cout << "shi wan";
              }
          }
          else
          {
              cout << "wan";
          }
          return 0;
      }
      
      • 2
        @ 2023-9-2 15:16:18

        easy

        #include<bits/stdc++.h>
        using namespace std;
        int main(){
        	int n;cin>>n;
        	if(n>=10000&&n<100000){
        		cout<<"wan";
        	}else if(n>=100000&&n<1000000){
        		cout<<"shi wan";
        	}else if(n>=1000000&&n<10000000){
        		cout<<"bai wan";
        	}else if(n>=10000000&&n<100000000){
        		cout<<"qian wan";
        	}else if(n>=100000000&&n<1000000000){
        		cout<<"yi";
        	}else{
        		cout<<"shi yi";
        	}
        	return 0;
        }
        
        • 2
          @ 2023-8-29 15:39:13
          #include<iostream>
          using namespace std;
          int main()
          {
              long long n,num=0;
              cin>>n;
              for(int i=1;i<=10;i++)
              {
                  if(n/10>=1)
                  {
                      n=n/10;
                      num++;
                  }
                  else
                  {
                      break;
                  }
              }
              for(int i=1;i<=1;i++)
              {
                  if(num>=9)
                  {
                      cout<<"shi yi";
                      break;
                  }
                  if(num>=8)
                  {
                      cout<<"yi";
                      break;
                  }
                  if(num>=7)
                  {
                      cout<<"qian wan";
                      break;
                  }
                  if(num>=6)
                  {
                      cout<<"bai wan";
                      break;
                  }
                  if(num>=5)
                  {
                      cout<<"shi wan";
                      break;
                  }
                  if(num>=4)
                  {
                      cout<<"wan";
                      break;
                  }
              }
              return 0;
          }
          
          • 2
            @ 2023-8-26 10:32:17

            暴力判断即可

            #include <iostream>
            using namespace std;
            int main()
            {
                int n;
                cin >> n;
                if (n >= 10000 and n <= 99999)
                {
                    cout << "wan";
                }
                if (n >= 100000 and n <= 999999)
                {
                    1cout << "shi wan";
                }
                if (n >= 1000000 and n <= 9999999)
                {
                    cout << "bai wan";
                }
                if (n >= 10000000 and n <= 99999999)
                {
                    cout << "qian wan";
                }
                if (n >= 100000000 and n <= 999999999)
                {
                    cout << "yi";
                }
                if (n >= 1000000000 and n <= 9999999999)
                {
                    cout << "shi yi";
                }
                return 0;
            }
            
            • 2
              @ 2023-8-20 11:38:02

              数学题

              #include <iostream>
              using namespace std;
              int main()
              {
                  int n;
                  cin>>n;
                  if (n/1000000000!=0)
                  {
                      cout<<"shi yi";
                  }
                  else if(n/100000000!=0)
                  {
                      cout<<"yi";
                  }
                  else if(n/10000000!=0)
                  {
                      cout<<"qian wan";
                  }
                  else if(n/1000000!=0)
                  {
                      cout<<"bai wan";
                  }
                  else if(n/100000!=0)
                  {
                      cout<<"shi wan";
                  }
                  else
                  {
                      cout<<"wan";
                  }
              }
              
              • 2
                @ 2023-8-16 20:28:22

                简单,就是if else if else 语句 #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if(n/10000<10) { cout << "wan"; } else if(n/10000<100) { cout << "shi wan"; } else if(n/10000<1000) { cout << "bai wan"; } else if(n/10000<10000) { cout << "qian wan"; } else if(n/10000<100000) { cout << "yi"; } else { cout << "shi yi"; }

                return 0; }

                • 2
                  @ 2023-8-13 15:31:03

                  大概看了其他题解,发现我的好像有点不一样( 用的是数位切分(应该是这么叫吧 反正能过 ~~(先赞后看好习惯~

                  #include <iostream>
                  using namespace std;
                  int main()
                  {
                      int n;
                      cin >> n;
                      if (n / 1000000000 >= 1)
                      {
                          cout << "shi yi";
                      }
                      else if (n / 100000000 >= 1)
                      {
                          cout << "yi";
                      }
                      else if (n / 10000000 >= 1)
                      {
                          cout << "qian wan";
                      }
                      else if (n / 1000000 >= 1)
                      {
                          cout << "bai wan";
                      }
                      else if (n / 100000 >= 1)
                      {
                          cout << "shi wan";
                      }
                      else if (n / 10000 >= 1)
                      {
                          cout << "wan";
                      }
                      return 0;
                  }
                  
                • 2
                  @ 2023-6-17 17:24:44
                  #include <bits/stdc++.h> 
                  using namespace std;
                  int main()
                  {
                      int n;
                      cin >> n;
                      if(n >= 10000 and n < 99999)
                      {
                          cout << "wan" << endl;
                      }
                      if(n >= 100000 and n < 999999)
                      {
                          cout << "shi wan" << endl;
                      }
                      if(n >= 1000000 and n < 9999999)
                      {
                          cout << "bai wan" << endl;
                      }
                      if(n >= 10000000 and n < 99999999)
                      {
                          cout << "qian wan" << endl;
                      }
                      if(n >= 100000000 and n < 999999999)
                      {
                          cout << "yi" << endl;
                      }
                      if(n >= 1000000000 and n < 9999999999)
                      {
                          cout << "shi yi" << endl;
                      }
                      return 0;
                  }
                  求点赞!!!
                  
                  • 2
                    @ 2022-8-3 17:01:26

                    if?if是不可呢写的,这题没必要

                    #include <iostream>
                    using namespace std;
                    string out[15] = {
                    	"草","ge","shi","bai","qian",
                    	"wan","shi wan","bai wan","qian wan",
                    	"yi","shi yi","bai yi" , "qian yi","草"}; //分行美观,数组存每位输出什么
                    long long n , i = 1;//我管他int会不会出事,看着大直接long long
                    int m ;//几位数
                    int main(){
                    	cin >> n ;//n>=10000 所以0啥的不用单独处理
                    	while(i < n)
                    		i *= 10 , m ++;//i >= n自动跳出,这时m就是数的位数
                    	cout << out[m] ;//输出
                    	return 0 ;//你就说写的少不少吧
                    }
                    

                    结合 @ 我又进行了修改

                    #include <iostream>
                    using namespace std;
                    string out[15] = {
                    	"草","ge","shi","bai","qian",
                    	"wan","shi wan","bai wan","qian wan",
                    	"yi","shi yi","bai yi" , "qian yi","草"};//同上
                    int main(){
                    	cin >> out[0] ;//0位置输入,不用再开一个string
                    	cout << out[out[0].length()] ;//string长度=位数
                    	//.length(),.size()都能获取长度,本质区别不大
                        return 0;//行数少了,但还是3ms,不行啊
                    }
                    
                    

                    点赞再抱走奥

                    • @ 2023-8-5 15:19:03

                      如果是我,我会把这串字符写成{ "草","草","草","草","草","草","草","草","草","草","草",……(此处省略10^10字)} 开个玩笑,何必当真呢?

                    • @ 2023-8-20 11:41:00

                      我再次修改

                      using namespace std;
                      string out[15] = {
                      "草","ge","shi","bai","qian",
                      "wan","shi wan","bai wan","qian wan",
                      "yi","shi yi","bai yi" , "qian yi","草"};//同上
                      int main(){
                      cin >> out[0] ;
                      cout << out[out[0].length()] 
                      }
                      
                  • 1
                    @ 2024-2-1 10:53:51
                    #include <iostream>
                    using namespace std;
                    int main()
                    {
                        long long a,num=0;
                        cin>>a;
                        while(a>0)
                        {
                            num++;
                            a/=10;
                        }
                        if(num==5)
                        {
                            cout<<"wan";
                        }
                        if(num==6)
                        {
                            cout<<"shi wan";
                        }
                        if(num==7)
                        {
                            cout<<"bai wan";
                        }
                        if(num==8)
                        {
                            cout<<"qian wan";
                        }
                        if(num==9)
                        {
                            cout<<"yi";
                        }
                        if(num==10)
                        {
                            cout<<"shi yi";
                        }
                        return 0;
                    }
                    
                    • 1
                      @ 2024-1-3 20:24:00

                      Ctrl+c/v用起来!!!(@陈元杰 都是复制if)

                      #include<bits/stdc++.h> 
                      using namespace std;
                      int main()
                      {
                          int n;
                          cin>>n;
                          if(n >= 10000 and n < 99999)  {
                              cout << "wan" << endl;
                          }
                          if(n >= 100000 and n < 999999)  {
                              cout << "shi wan" << endl;
                          }
                          if(n >= 1000000 and n < 9999999)  {
                              cout << "bai wan" << endl;
                          }
                          if(n >= 10000000 and n < 99999999)  {
                              cout << "qian wan" << endl;
                          }
                          if(n >= 100000000 and n < 999999999)  {
                              cout << "yi" << endl;
                          }
                          if(n >= 1000000000 and n < 9999999999)  {
                              cout << "shi yi" << endl;
                          }
                          return 0;
                      }
                      
                      • 1
                        @ 2023-12-29 18:54:31
                        #include <bits/stdc++.h> 
                        using namespace std;
                        int main()
                        {
                            int n;
                            cin >> n;
                            if(n >= 10000 and n < 99999)
                            {
                                cout << "wan" << endl;
                            }
                            if(n >= 100000 and n < 999999)
                            {
                                cout << "shi wan" << endl;
                            }
                            if(n >= 1000000 and n < 9999999)
                            {
                                cout << "bai wan" << endl;
                            }
                            if(n >= 10000000 and n < 99999999)
                            {
                                cout << "qian wan" << endl;
                            }
                            if(n >= 100000000 and n < 999999999)
                            {
                                cout << "yi" << endl;
                            }
                            if(n >= 1000000000 and n < 9999999999)
                            {
                                cout << "shi yi" << endl;
                            }
                            return 0;
                        }
                        
                        
                        • 1
                          @ 2023-12-4 18:18:20

                          #include <iostream> using namespace std; int main() { int n; cin >> n;//这个不要漏 if (n < 100000)//if语句判断,以此类推 { cout << "wan" << endl;//通过判断,进行输出 } else if (n < 1000000) { cout << "shi wan" << endl; } else if (n < 10000000) { cout << "bai wan" << endl; } else if (n < 100000000) { cout << "qian wan" << endl; } else if (n < 1000000000) { cout << "yi" << endl; } else { cout << "shi yi" << endl; } return 0; }//

                          • 1
                            @ 2023-11-29 19:59:03
                            #include <iostream>
                            using namespace std;
                            int main()
                            {
                                int x;
                                cin >>x;
                                if (x<10)
                                {
                                    cout <<"ge";
                                }
                                if (x>=10)
                                {
                                    if (x<=99)
                                    {
                                        cout <<"shi";
                                    }
                                }
                                if (x>=100)
                                {
                                    if (x<=999)
                                    {
                                        cout <<"bai";
                                    }
                                }
                                if (x>=1000)
                                {
                                    if (x<=9999)
                                    {
                                        cout <<"qian";
                                    }
                                }
                                if (x>=10000)
                                {
                                    if (x<=99999)
                                    {
                                        cout <<"wan";
                                    }
                                }
                                if (x>=100000)
                                {
                                    if (x<=999999)
                                    {
                                        cout <<"shi wan";
                                    }
                                }
                                if (x>=1000000)
                                {
                                    if (x<=9999999)
                                    {
                                        cout <<"bai wan";
                                    }
                                }
                                if (x>=10000000)
                                {
                                    if (x<=99999999)
                                    {
                                        cout <<"qian wan";
                                    }
                                }
                                if (x>=100000000)
                                {
                                    if (x<=999999999)
                                    {
                                        cout <<"yi";
                                    }
                                }
                                if (x>=1000000000)
                                {
                                    if (x<=9999999999)
                                    {
                                        cout <<"shi yi";
                                    }
                                }
                                if (x>=10000000000)
                                {
                                    if (x<=99999999999)
                                    {
                                        cout <<"bai yi";
                                    }
                                }
                                if (x>=100000000000)
                                {
                                    if (x<=999999999999)
                                    {
                                        cout <<"qian yi";
                                    }
                                }
                                if (x>=1000000000000)
                                {
                                    if (x<=9999999999999)
                                    {
                                        cout <<"zhao";
                                    }
                                }
                                return 0;
                            }
                            

                            以AC,可以放心食用

                            • 1
                              @ 2023-11-29 19:57:23

                              #include <iostream> using namespace std; int main() { int x; cin >>x; if (x<10) { cout <<"ge"; } if (x>=10) { if (x<=99) { cout <<"shi"; } } if (x>=100) { if (x<=999) { cout <<"bai"; } } if (x>=1000) { if (x<=9999) { cout <<"qian"; } } if (x>=10000) { if (x<=99999) { cout <<"wan"; } } if (x>=100000) { if (x<=999999) { cout <<"shi wan"; } } if (x>=1000000) { if (x<=9999999) { cout <<"bai wan"; } } if (x>=10000000) { if (x<=99999999) { cout <<"qian wan"; } } if (x>=100000000) { if (x<=999999999) { cout <<"yi"; } } if (x>=1000000000) { if (x<=9999999999) { cout <<"shi yi"; } } if (x>=10000000000) { if (x<=99999999999) { cout <<"bai yi"; } } if (x>=100000000000) { if (x<=999999999999) { cout <<"qian yi"; } } if (x>=1000000000000) { if (x<=9999999999999) { cout <<"zhao"; } } return 0; }

                              以AC,可以放心食用^^ ** _

                              • 1
                                @ 2023-11-22 19:54:57

                                这题就是无脑狂写if语句 突然发现Ctrl+CV 是真香😄

                                #include <bits/stdc++.h> 
                                using namespace std;
                                int main()
                                {
                                    int n;
                                    cin >> n;
                                    if(n >= 10000 and n < 99999)
                                    {
                                        cout << "wan" << endl;
                                    }
                                    if(n >= 100000 and n < 999999)
                                    {
                                        cout << "shi wan" << endl;
                                    }
                                    if(n >= 1000000 and n < 9999999)
                                    {
                                        cout << "bai wan" << endl;
                                    }
                                    if(n >= 10000000 and n < 99999999)
                                    {
                                        cout << "qian wan" << endl;
                                    }
                                    if(n >= 100000000 and n < 999999999)
                                    {
                                        cout << "yi" << endl;
                                    }
                                    if(n >= 1000000000 and n < 9999999999)
                                    {
                                        cout << "shi yi" << endl;
                                    }
                                    return 0;
                                }
                                

                                Copy

                                编码不易😕,点赞走起👀️ 记得点赞再抱走奥😄

                                信息

                                ID
                                319
                                时间
                                1000ms
                                内存
                                16MiB
                                难度
                                3
                                标签
                                递交数
                                4873
                                已通过
                                2630
                                上传者