正确做法 审核通过

lyhmbr CSP-J2二等 2023-10-11 17:32:32 94
#include <bits/stdc++.h>
using namespace std;

int a[10000007]; int n;

int to_(string abc){ n = abc.size(); for(int i = 0 ; i < n ; i++){ // if(abc[i] >= 'A' && abc[i] <= 'Z' ){ // a[i] = abc[i] - 'A'; // } else if(abc[i] >= 'a' && abc[i] <='z'){ //// a[i] = abc[i]; // } a[i] = abc[i]; } }

int pd(int a){ return 0; if(a >= 'A' && a <= 'Z'){ return 1; }else if(a >= 'a' && a <= 'z'){ return 2; } else{ return 0; } }

void print(){ int len = n; for(int i = 0 ; i < len ; i++){ char t; // if(a[i] != ' ' || a[i] != '!'){ // t += a[i] + 'A'; // cout<<t; // }else{ // a[i] == ' ' ? cout<<" " : cout<<"!"; // } int tt = pd(a[i]); if(tt == 1){ t += a[i] +'A'; } if(tt == 2){ t += a[i] + 'a'; } if(tt == 0){ t = a[i]; } // cout<<a[i]<<" "; cout<<t; } }

int main(){ to_("Hello World"); print();

<span class="hl-keyword hl-control hl-c++">return</span> <span class="hl-constant hl-numeric hl-c++">0</span><span class="hl-punctuation hl-terminator hl-c++">;</span>

}

用NOIc++测

{{ vote && vote.total.up }}

共 15 条回复

oj89

6

lyhldy CSP-J2二等

老兄,6

114514

6

lyhxwc

rj

lyhxwc