7 条题解

  • 5
    @ 2024-1-31 15:09:42

    兄弟们,暴力出奇迹啊

    已AC,请放心食用👀️

    ( •̀ ω •́ )✧

    #include <iostream>
    using namespace std;
    int main()
    {
        string n;
        cin >> n;
        for (int i = 0; i < n.length(); i++)
        {
            if (n[i] == 'O')
            {
                n[i] = 0;
            }
            else if (n[i] == 'l')
            {
                cout << 1;
            }
            else if (n[i] == 'Z')
            {
                cout << 2;
            }        
            else if (n[i] == 'S')
            {
                cout << 5;
            }        
            else if (n[i] == 'b')
            {
                cout << 6;
            }        
            else if (n[i] == 'B')
            {
                cout << 8;
            }        
            else if (n[i] == 'q')
            {
                cout << 9;
            }
            else
            {
                cout << n[i];
            } 
        }
        return 0;
    }
    

    显示这个,你就做对了

    foo.cc: In function 'int main()':
    foo.cc:7:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
         for (int i = 0; i < n.length(); i++)
                         ~~^~~~~~~~~~~~
    
  • 4
    @ 2023-8-20 21:02:37

    啊...暴力出奇迹👀️

    c++代码:

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        string a;
        cin >> a;
        for (int i = 0; i < a.length(); i++)
        {
            if (a[i] == 'O') cout << 0;
            else if (a[i] == 'l') cout << 1;
            else if (a[i] == 'Z') cout << 2;
            else if (a[i] == 'S') cout << 5;
            else if (a[i] == 'b') cout << 6;
            else if (a[i] == 'B') cout << 8;
            else if (a[i] == 'q') cout << 9;
            else cout << a[i];
        }
        return 0;
    }
    

    python代码:

    a = input()
    for i in a:
        if (i == "O"):
            print(0,end = "")
        elif (i == "l"):
            print(1,end = "")
        elif (i == "Z"):
            print(2,end = "")
        elif (i == "S"):
            print(5,end = "")
        elif (i == "b"):
            print(6,end = "")
        elif (i == "B"):
            print(8,end = "")
        elif (i == "q"):
            print(9,end = "")
        else:
            print(i,end = "")
    

    都已AC,放心食用

    • 3
      @ 2023-7-8 8:50:31
      #include <iostream>
      #include <string>
      using namespace std;
      int main()
      {
      	string a;
      	getline(cin, a);
      	for (int i = 0; i < a.size(); i++)
      	{
      		if (a[i] == 79)
      		{
      			a[i] = 48;
      		}
      		if (a[i] == 108)
      		{
      			a[i] = 49;
      		}
      		if (a[i] == 90)
      		{
      			a[i] = 50;
      		}
      		if (a[i] == 83)
      		{
      			a[i] = 53;
      		}
      		if (a[i] == 98)
      		{
      			a[i] = 54;
      		}
      		if (a[i] == 66)
      		{
      			a[i] = 56;
      		}
      		if (a[i] == 113)
      		{
      			a[i] = 57;
      		}
      	}
      	cout << a;
      	return 0;
      }
      
      • 2
        @ 2023-8-11 16:45:52
        #include <bits/stdc++.h>
        using namespace std;
        char s;
        int main()
        {
            while(cin>>s)
            {
                if(s=='O') cout<<0;
                else if(s=='l') cout<<1;
                else if(s=='Z') cout<<2;
                else if(s=='S') cout<<5;
                else if(s=='b') cout<<6;
                else if(s=='B') cout<<8;
                else if(s=='q') cout<<9;
                else cout<<s;
            }
            return 0;
        }
        
        • 2
          @ 2023-7-14 21:01:43

          纯粹暴力扫描

          #include <iostream>
          using namespace std;
          int main(){
              string s;
              cin>>s;
              for(int i=0;i<s.length();i++){
                  if(s[i]=='O')s[i]='0';
                  else if(s[i]=='l')s[i]='1';
                  else if(s[i]=='Z')s[i]='2';
                  else if(s[i]=='S')s[i]='5';
                  else if(s[i]=='b')s[i]='6';
                  else if(s[i]=='B')s[i]='8';
                  else if(s[i]=='q')s[i]='9';
              }
              cout<<s<<endl;
              return 0;
          }
          
          • 1
            @ 2024-2-6 20:47:41

            又是狂写if的一天(〃'▽'〃)

            #include <iostream> 
            #include <cstring>
            using namespace std;
            string a;
            int main()
            {
                cin>>a;
                for(int i=0;i<a.length();i++){
                    //把数字0错误地识别为大写字母O
                    if(a[i]=='O')
                        cout<<0;
                    //把数字1错误地识别为小写字母l
                    else if(a[i]=='l')
                        cout<<1;
                    //把数字2错误地识别为大写字母Z
                    else if(a[i]=='Z')
                        cout<<2;
                    //把数字5错误地识别为大写字母S
                    else if(a[i]=='S')
                        cout<<5;            
                    //把数字6错误地识别为小写字母b
                    else if(a[i]=='b')
                        cout<<6;
                    //把数字8错误地识别为大写字母B
                    else if(a[i]=='B')
                        cout<<8;
                    //把数字9错误地识别为小写字母q
                    else if(a[i]=='q')
                        cout<<9;
                    //正常输出
                    else
                        cout<<a[i];
                }
                return 0;
            }
            
            • 1
              @ 2023-6-29 9:54:33
              #include <bits/stdc++.h>
              using namespace std;
              char c[256];
              string s;
              int main(){
                  c['O']='0',c['l']='1',c['Z']='2',c['S']='5',c['b']='6',c['B']='8',c['q']='9';
                  //连接对应的字母及数字
                  cin>>s;
                  for (int i=0;i<s.size();i++){
                      if (c[s[i]]){
                          s[i]=c[s[i]];
                      }
                  }
                  cout<<s;
                  return 0;
              }
              
              • 1

              信息

              ID
              100
              时间
              1000ms
              内存
              16MiB
              难度
              1
              标签
              递交数
              110
              已通过
              76
              上传者