QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179086#6893. Kong Ming QiPPP#AC ✓0ms3556kbC++17887b2023-09-14 17:47:272023-09-14 17:47:27

Judging History

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

  • [2023-09-14 17:47:27]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3556kb
  • [2023-09-14 17:47:27]
  • 提交

answer

#ifdef DEBUG
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

//const ll mod = 1000000007;
const ll mod = 998244353;

#define X first
#define Y second

ll pew(ll a, ll b)
{
    ll res = 1;
    while (b>0)
    {
        if (b&1) res = res*a%mod;
        b >>= 1;
        a = a*a%mod;
    }
    return res;
}



void solve()
{
    ll n, m;
    cin >> n >> m;
    if (n>m) swap(n,m);
    if (n==1)
    {
        cout << (m+1)/2 << "\n";
        return;
    }
    if (n*m%3==0) cout << 2 << "\n";
    else cout << 1 << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//#ifdef DEBUG
    //freopen("input.txt", "r", stdin);
//#endif
    int T = 1;
    cin >> T;
    while (T--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

100
1 1
2 1
3 1
4 1
5 1
6 1
1 2
2 2
3 2
4 2
5 2
6 2
1 3
2 3
3 3
4 3
5 3
6 3
1 4
2 4
3 4
4 4
5 4
6 4
1 5
2 5
3 5
4 5
5 5
6 5
1 6
2 6
3 6
4 6
5 6
6 6
1 27
28 1
1 29
30 1
1 31
32 1
1 33
34 1
1 35
36 1
2 27
28 2
2 29
30 2
2 31
32 2
2 33
34 2
2 35
36 2
3 27
28 3
3 29
30 3
3 31
32 3
3 33
34 3
3 35
36 3
4 ...

output:

1
1
2
2
3
3
1
1
2
1
1
2
2
2
2
2
2
2
2
1
2
1
1
2
3
1
2
1
1
2
3
2
2
2
2
2
14
14
15
15
16
16
17
17
18
18
2
1
1
2
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
1
1
2
1
1
2
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
2
1
1
2
2
1
1
2

result:

ok 100 lines