QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#701850#5542. Doubled GCDMeatInTheMiddle#WA 0ms3684kbC++171022b2024-11-02 14:48:502024-11-02 14:48:51

Judging History

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

  • [2024-11-02 14:48:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-11-02 14:48:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define fastio (ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL))
typedef long long ll;
typedef long double lld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const int MAXSIZE = 2000000;
const long long INF = 1e18 + 5;
const double EPSILON = 1e-14;
const ll DIV = 2000003;
const long double pi = 3.14159265358979323846264338327950288419716939937510L;

int n;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
pair<int, int> arr[200005];

int get(int a)
{
    int ret = 0;
    while (a % 2 == 0)
        ret++, a /= 2;
    return ret;
}

int main()
{
    fastio;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i].second;
        arr[i].first = get(arr[i].second);
    }
    sort(arr, arr + n);
    int ans = arr[0].second;

    for (int i = 1; i < n; i++)
    {
        ans = 2 * gcd(ans, arr[i].second);
    }
    cout << ans;

    return 0;
}

详细

Test #1:

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

input:

3
2 4 6

output:

8

result:

ok single line: '8'

Test #2:

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

input:

3
3 5 7

output:

2

result:

ok single line: '2'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3660kb

input:

4
9 9 9 9

output:

18

result:

wrong answer 1st lines differ - expected: '36', found: '18'