(欢乐赛 #38) T2 题解
2025-01-15 15:17:13
发布于:广东
11阅读
0回复
0点赞
用字符串,遇2转8,遇8转2。
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100000000];
    cin>>s;
    int n = strlen(s);
    for(int i=0;i<n;i++){
    	if(s[i]=='2')s[i]='8'; else if(s[i]=='8')s[i]='2';
    }
    cout<<s;
    return 0;
}
这里空空如也







有帮助,赞一个