QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#767320#6607. Rise of ShadowsSGColinCompile Error//C++20325b2024-11-20 20:33:152024-11-20 20:33:18

Judging History

你现在查看的是最新测评结果

  • [2024-11-20 20:33:18]
  • 评测
  • [2024-11-20 20:33:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}

int main() {
	ll h, m, a;
        scanf("%lld%lld%lld", &h, &m, &a);
	if (a * 2 == h * m) {printf("%lld\n", 1ll * h * m); return 0;}
	ll g = gcd(h - 1, h * m);
	printf("%lld\n", g * (2 * (a / g) + 1));
	return 0;
}

详细

answer.code:4:1: error: ‘ll’ does not name a type
    4 | ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
      | ^~
answer.code: In function ‘int main()’:
answer.code:7:9: error: ‘ll’ was not declared in this scope
    7 |         ll h, m, a;
      |         ^~
answer.code:8:32: error: ‘h’ was not declared in this scope
    8 |         scanf("%lld%lld%lld", &h, &m, &a);
      |                                ^
answer.code:8:36: error: ‘m’ was not declared in this scope; did you mean ‘tm’?
    8 |         scanf("%lld%lld%lld", &h, &m, &a);
      |                                    ^
      |                                    tm
answer.code:8:40: error: ‘a’ was not declared in this scope
    8 |         scanf("%lld%lld%lld", &h, &m, &a);
      |                                        ^
answer.code:10:11: error: expected ‘;’ before ‘g’
   10 |         ll g = gcd(h - 1, h * m);
      |           ^~
      |           ;
answer.code:11:26: error: ‘g’ was not declared in this scope
   11 |         printf("%lld\n", g * (2 * (a / g) + 1));
      |                          ^