11 条题解

  • 3
    @ 2024-1-26 11:42:53

    # 本题进化史 1:数组法

    #include <bits/stdc++.h>
    using namespace std;
    int k;
    char v[30];
    int main(){
        for (int i=0;i<26;i++){
            v[i]=i+'a';
            cout<<v[i];
            k++;
            if (k==13){
                cout<<endl;
                k=0;
            }
        }
        for (int i=25;i>=0;i--){
            cout<<v[i];
            k++;
            if (k==13)cout<<endl;
        }
        return 0;
    }
    

    2:字符法

    #include <bits/stdc++.h>
    using namespace std;
    char v;
    int k;
    int main(){
        for (int i=0;i<26;i++){
            v='a';
            v+=i;
            cout <<v;
            k++;
            if (k%13==0){
                cout<<endl;
                k=0;
            }
                
        }
        for (int i=0;i<26;i++){
            v='z';
            v-=i;
            cout<<v;
            k++;
            if (k%13==0)cout<<endl;
        }
        return 0;
    }
    

    3:可耻打表法

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        cout<<"abcdefghijklm\nnopqrstuvwxyz\nzyxwvutsrqpon\nmlkjihgfedcba";
        return 0;
    }
    

    本题其实也可以用vector和树状数组做,这边便不详写了。

    • 1
      @ 2024-4-15 20:12:14
      #include<iostream>
      using namespace std;
      int main(){
          for(int i=97;i<=109;i++)//第一行
              cout<<char(i);
          cout<<endl;
          for(int i=110;i<=122;i++)//第二行
              cout<<char(i);
          cout<<endl;
          for(int i=122;i>=110;i--)//第三行
              cout<<char(i);
          cout<<endl;
          for(int i=109;i>=97;i--)//第四行
              cout<<char(i);
          //当然,可以直接输出……
          return 0;
      }//编者:Royal
      
      • 1
        @ 2024-1-29 11:23:32

        复制一下样例中的输出数据就行了呗~

        #include <iostream>
        using namespace std;
        int main()
        {
            cout << "abcdefghijklm" << endl;
            cout << "nopqrstuvwxyz" << endl;
            cout << "zyxwvutsrqpon" << endl;
            cout << "mlkjihgfedcba" << endl;
            return 0;
        }
        
        • 0
          @ 2023-11-21 21:17:55

          代码如下:

          #include <iostream>
          using namespace std;
          int main()
          {
              char a;
              for (int i=1;i<=26;i++)
              {
                  a='a';
                  a+=i-1;
                  cout << a;
                  if (i%13==0)
                  {
                      cout << endl;
                  }
              }
              for (int i=1;i<=26;i++)
              {
                  a='a';
                  a+=26-i;
                  cout << a;
                  if (i%13==0)
                  {
                      cout << endl;
                  }
              }
              return 0;
          }
          

          保证不作弊,正确代码!

          ——已AC

          • 0
            @ 2023-8-24 14:17:29

            e,这题真难

            #include<iostream>
            using namespace std;
            int main()
            {
            cout<<"abcdefghijklm"<<endl;
            cout<<"nopqrstuvwxyz"<<endl;
            cout<<"zyxwvutsrqpon"<<endl;
            cout<<"mlkjihgfedcba"<<endl;
            return 0;
            }
            
            • 0
              @ 2023-8-16 16:13:08

              哇哇哇

              #include<iostream>
              using namespace std;
              int main()
              {
                  cout<<"abcdefghijklm"<<endl;
                  cout<<"nopqrstuvwxyz"<<endl;
                  cout<<"zyxwvutsrqpon"<<endl;
                  cout<<"mlkjihgfedcba"<<endl;
                  return 0;
              }
              
              • 0
                @ 2023-8-9 23:11:16
                #include <bits/stdc++.h>
                using namespace std;
                int main()
                {
                    printf("abcdefghijklm\nnopqrstuvwxyz\nzyxwvutsrqpon\nmlkjihgfedcba");
                    return 0;
                }
                
                • 0
                  @ 2023-8-5 22:21:05
                  #include <iostream>
                  int main()
                  {
                      std::cout << "abcdefghijklm\nnopqrstuvwxyz\nzyxwvutsrqpon\nmlkjihgfedcba";
                      return 0;
                  }
                  
                  • -1
                    @ 2023-7-8 7:51:46
                    #include <iostream>
                    using namespace std;
                    int main()
                    {
                    	string a = "abcdefghijklm";
                    	string b = "nopqrstuvwxyz";
                    	string c = "zyxwvutsrqpon";
                    	string d = "mlkjihgfedcba";
                    	cout << a << endl;
                    	cout << b << endl;
                    	cout << c << endl;
                    	cout << d;
                    	return 0;
                    }
                    
                    • -1
                      @ 2023-6-4 13:30:18

                      暴力输出

                      #include <bits/stdc++.h>
                      using namespace std;
                      int main()
                      {
                          cout << "abcdefghijklm" << endl;
                          cout << "nopqrstuvwxyz" << endl;
                          cout << "zyxwvutsrqpon" << endl;
                          cout << "mlkjihgfedcba" << endl;
                          return 0;
                      }
                      
                      • -1
                        @ 2022-4-6 20:46:52

                        #include <bits/stdc++.h> using namespace std; int main() { for(int i=1;i<=26;i++) { cout<<char('a'+i-1); if(i%130)cout<<endl; } for(int i=1;i<=26;i++) { cout<<char('z'-i+1); if(i%130)cout<<endl; } return 0; }//AC100

                        • 1

                        信息

                        ID
                        94
                        时间
                        1000ms
                        内存
                        16MiB
                        难度
                        2
                        标签
                        递交数
                        187
                        已通过
                        119
                        上传者