QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#763195#6992. Caesar Cipherhejinming983282#AC ✓0ms3816kbC++231.0kb2024-11-19 18:49:392024-11-19 18:49:41

Judging History

This is the latest submission verdict.

  • [2024-11-19 18:49:41]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3816kb
  • [2024-11-19 18:49:39]
  • Submitted

answer

// Author : hejinming2012
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define dbg(x) cout << #x " = " << (x) << endl
#define quickio ios::sync_with_stdio(false);
#define quickin cin.tie(0);
#define quickout cout.tie(0);

using namespace std;
inline int read() {
	int now = 0, nev = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') nev = -1; c = getchar(); }
	while(c >= '0' && c <= '9') { now = (now << 1) + (now << 3) + (c & 15); c = getchar(); }
	return now * nev;
}
void write(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) write(x / 10);
	putchar(x % 10 + '0');
}

signed main() {
	quickio
	quickin
    quickout
    int T; cin >> T;
	for(int _ = 1; _ <= T; _++) {
		int n, m; cin >> n >> m;
		string s1, s2, s3, s4;
		cin >> s1 >> s2 >> s3, s4 = s3;
		int n1 = s1[0] - 'A';
		int n2 = s2[0] - 'A';
		if(n2 < n1) n2 += 26;
		int num = n2 - n1;
		for(int i = 0; i < m; i++)
			s4[i] = (s3[i] - 'A' - num + 26) % 26 + 'A';
		cout << "Case #" << _ << ": " << s4 << endl;
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3816kb

input:

1
7 7
ACMICPC
CEOKERE
PKPIZKC

output:

Case #1: NINGXIA

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

50
13 17
QHTWLYQKPWWMF
TKWZOBTNSZZPI
ZMNVMCRXALWYDGEQH
22 43
UVODXVNTBFCPCYQNVTZGOB
WXQFZXPVDHEREASPXVBIQD
QPDUBYVLOYAISDULLCKTMYTBNYPPHVKYJKUUIXGBRIU
12 15
XQOEAHPCECGP
VOMCYFNACAEN
DONXFWMMTBGNHIV
12 22
LIPJSGBNANXU
EBICLZUGTGQN
JKSXVASDNGTLJFOWVDGQDV
13 40
BGJHQVBCMLQND
LQTRAFLMWVAXN
UDQREUFWBGIH...

output:

Case #1: WJKSJZOUXITVADBNE
Case #2: ONBSZWTJMWYGQBSJJAIRKWRZLWNNFTIWHISSGVEZPGS
Case #3: FQPZHYOOVDIPJKX
Case #4: QRZECHZKUNASQMVDCKNXKC
Case #5: KTGHUKVMRWYXEDHAXQCLTXKOCSFPKQXKAZXQSRPM
Case #6: ZQIRTMTIKTENA
Case #7: GD
Case #8: N
Case #9: PLCAOJZKAIELLKYHWHJHKLDCHVLFECTIMQAQQENZCLTJWUOCJ
Case #10...

result:

ok 150 tokens