Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
52531 wzj33300 修复符文 C++ 运行出错 20 3 MS 568 KB 1098 2022-07-19 12:39:48

Tests(4/20):


#include <bits/stdc++.h> using namespace std; int t; string s, r; string z; int n; void upd(int a) { for (int i = 0; i < a; i++) { z[i] = s[a - i - 1]; } for (int i = a; i < n; i++) { z[i] = s[n + a - i - 1]; } for (int i = 0; i < n; i++) { s[i] = z[i]; } } int a, b; map<string, bool> mp; int main() { scanf("%d", &t); while (t--) { // scanf("%s%s", s + 1, r + 1); cin >> s >> r; scanf("%d%d", &a, &b); n = s.size(); if (a < b) swap(a, b); // int g = __gcd(n, a / b); // printf("%d\n", g); bool can = 0; for (int i = 1; i <= n; i++) { upd(a); if (s == r) { can = 1; break; } // printf("%s\n", s + 1); // for (int j = 1; j <= n; j++) { // printf("%c", s[j]); // } // printf("\n"); upd(b); if (s == r) { can = 1; break; } // for (int j = 1; j <= n; j++) { // printf("%c", s[j]); // } // printf("\n"); // printf("%s\n", s + 1); } printf((can ? "yes\n" : "no\n")); } } /* 3 ljhelloh hellohlj 2 4 thisisastr htrtsasisi 3 5 abcde bcdea 1 4 */


测评信息: