å®é¨ãã¦ãããã¡ã«ã·ã³ãã«ãªæ§é ãããã£ãã
åé¡æ¦è¦
è±æåãããªãé·ã ã®æåå ãä¸ããããããã®æååã«å¯¾ãã¦ã次ã®æä½ã åè¡ã£ã¦ã§ããæååãèããã
ãæä½ã
æåå ã«å¯¾ãã¦ãè±å°æåã¨è±å¤§æåãå
¥ãæ¿ãã¦ã§ããæååã ã¨ãã¦ã ã ã§ç½®ãæãã
ãã®æååã«å¯¾ãã¦ã åã®ã¯ã¨ãªãæ´æ° ãä¸ããããã®ã§ãå é ãã çªç®ã®æåã«çãããã«çããã
å¶ç´
èãããã¨
0-indexed ã§èãããã¨ã«ãããã¯ã¨ãªã¨ãã¦ä¸ãããã ã®å¤ããã¯ãªã¡ã³ããã¦ãããã¨ã¨ããã
ãã¦ããã¨ã®æåå ã«å¯¾ãã¦ã大æåã¨å°æåãå ¥ãæ¿ããæååã ã¨ãããããã®ã¨ããæä½ãåååæ°è¡ãã¨ã
ããã®é ã«é£çµãããã®ã¨ãªããã¾ãä¸ã¤éè¦ãªãã¨ã¯ã ã ã§å²ã£ãåã ãä½ãã ã¨ããã¨ãæ±ããæåã¯ã
- ä¸è¨ã®æååã®åã® çªç®ã®æååã«ã¤ãã¦
- å é ãã çªç®ã®æå
ã§ããã¨ãããã¨ã ããã£ã¦ãåé¡ã¯æ¬¡ã®ãã®ã«å¸°çãããã
æååã®å
ã«ã¤ãã¦ã çªç®ã®ãã®ã¯ ã®ããããï¼
æååã®åãèãã
æååã®åã«ä½ãè¦åæ§ããªããã¨èãã¦ã¿ããã注ç®ããããã¨ã¯ããæååã®åãã®ä½ãæ¹ãããã¦ãæååã®åã® çªç®ã¯ã ã¨äº¤äºã«ãªã£ã¦ãããã¨ã ï¼æååã®åã®ä½ãæ¹ããæããï¼ã
ãã®ãã¨ããããã£ã¨æååã®åã® çªç®ã®å¤ã¯ã ãäºé²æ³ã§è¡¨ãã¨ãè¯ããã¨ãããã®ã§ã¯ãªããã¨èããããã£ã¦ã¿ããï¼ï¼
çªç® | çªç®ï¼äºé²æ³ï¼ | æåå | äºé²æ³ã® 1 ã®åæ° |
---|---|---|---|
0 | 0 | 0 | |
1 | 1 | 1 | |
2 | 10 | 1 | |
3 | 11 | 2 | |
4 | 100 | 1 | |
5 | 101 | 2 | |
6 | 110 | 2 | |
7 | 111 | 3 | |
8 | 1000 | 1 | |
9 | 1001 | 2 | |
10 | 1010 | 2 | |
11 | 1011 | 3 | |
12 | 1100 | 2 | |
13 | 1101 | 3 | |
14 | 1110 | 3 | |
15 | 1111 | 4 |
ãããè¦ãã¨ãæååã®åã® çªç®ã®é ã¯ã ãäºé²æ³ã§è¡¨ããã¨ãã® 1 ã®åæ°ã ã¨ãã¦ã
- ãå¶æ°ã®ã¨ãï¼
- ãå¥æ°ã®ã¨ãï¼
ã¨ãªããã¨ããããã証æã¯ãä¸è¬ã« æªæºã®æ´æ° ã«å¯¾ãã¦ã ã§ãããã¨ããå°ããï¼è©³ç´°ã¯å ¬å¼è§£èª¬ããï¼ã
è¨ç®é㯠ã¨ãªãã
ã³ã¼ã
#include <bits/stdc++.h> using namespace std; int main() { long long Q, K; string S; cin >> S >> Q; auto flip = [&](char c) -> char { if (islower(c)) return toupper(c); else return tolower(c); }; while (Q--) { cin >> K; K--; long long q = K / S.size(), r = K % S.size(); long long num = 0; for (int i = 0; i < 61; i++) if (q & (1LL << i)) num++; if (num % 2 == 0) cout << S[r] << " "; else cout << flip(S[r]) << " "; } cout << endl; }