/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 480.0 KiB
#3 Accepted 4ms 620.0 KiB
#4 Accepted 26ms 1.316 MiB
#5 Accepted 32ms 2.062 MiB
#6 Accepted 32ms 2.062 MiB

Code

/**
 *  Author: AhSaN (JUST-22)
 *  Created: 06-09-2024  08:00:49
**/
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
using namespace std;

void Sol(int Cs) {
  long long a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  long long res = (b - a) * a;
  res += a * (a - 1);
  cout << res << "\n";
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int Tc = 1;
  cin >> Tc;
  for (int Cs = 1; Cs <= Tc; Cs++) {
    Sol(Cs);
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1075 GCD not equal LCM
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-06 03:06:43
Judged At
2024-11-11 02:56:59
Judged By
Score
100
Total Time
32ms
Peak Memory
2.062 MiB