답안 #381332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381332 2021-03-25T06:27:34 Z ikg Košnja (COCI17_kosnja) C++14
50 / 50
15 ms 620 KB
    // by ikg

#include <bits/stdc++.h>

using namespace std;

const int E9 = 1e9;
const int E8 = 1e8;
const int E7 = 1e7;
const int E6 = 1e6;
const int E5 = 1e5;
const int E4 = 1e4;
const int E3 = 1e3;

const int N = 5e5+7;
const long long INF = 1e18;

#define gcd __gcd
#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second
#define ld long double
#define debug cout<<"bug "
#define endl cout<<'\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sd(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define sld(x) scanf("%lf",&x)
#define pd(x) printf("%d",x)
#define pll(x) printf("%lld",x)
#define pld(x) printf("%lf",x)

void solve()
{
    int n, m, ans=0;
    cin >> n >> m;
    if (n!=1&&m!=1) ans=min(n,m)+min(n,m)-2;
    cout << ans;
}

int main ()
{
    ios;
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 10 ms 492 KB Output is correct
7 Correct 14 ms 620 KB Output is correct
8 Correct 10 ms 620 KB Output is correct
9 Correct 15 ms 620 KB Output is correct
10 Correct 15 ms 620 KB Output is correct