QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882839#9768. A + B = C ProblemforgotmyhandleCompile Error//C++14613b2025-02-05 11:51:412025-02-05 11:51:42

Judging History

This is the latest submission verdict.

  • [2025-02-05 11:51:42]
  • Judged
  • [2025-02-05 11:51:41]
  • Submitted

answer

#include <iostream>
#define int long long
using namespace std;
signed main() {
    int tc;
    cin >> tc;
    while (tc--) {
        int a, b, c;
        cin >> a >> b >> c;
        if (a * b / __gcd(a, b) != c) {
            cout << "NO\n";
            continue;
        }
        string A = "0", B = "0", C;
        for (int i = 1; i < a; i++) A += '1';
        for (int i = 1; i < b; i++) B += '1';
        cout << "YES\n";
        cout << A << "\n" << B << "\n";
        for (int i = 0; i < c; i++) cout << (char)('0' + (A[i % a] ^ B[i % b]));
        cout << "\n";
    }
    return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:10:21: error: ‘__gcd’ was not declared in this scope; did you mean ‘__gid_t’?
   10 |         if (a * b / __gcd(a, b) != c) {
      |                     ^~~~~
      |                     __gid_t