# UVa 10082 - WERTYU --- # 題目大意 給一字串,對每個字元輸出其在鍵盤上左邊一格的字元,空格要保留。 --- # 題解 先建一個字串從鍵盤左邊按到右邊,接下來掃一遍題目的字串對應輸出即可。 --- ```=C++ #include <bits/stdc++.h> #define ll long long #define pb push_back #define INF 2147483647 #define ft first #define sec second #define pr pair<int,int> #define ISCC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; int t ,n ,m ,ans ,tp; string s ,mp="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";; int main() { ISCC; while(getline(cin,s)) { for(int i=0 ;i<s.size() ;i++) { int it = mp.find(s[i]); if(s[i]==' ') cout << s[i]; else cout << mp[it-1]; } cout << '\n'; } } ```
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.