Submission #34348905


Source Code Expand

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

ll n, a, b;

void result(ll x) {
  cout << x;
  exit(0);
}

int main()
{
  cin >> n >> a >> b;

  if (n < a) result(0);
  n -= a - 1;

  if (a <= b) result(n);

  ll groups = n / a;
  ll rem = n % a;
  ll res = groups * b + min(b, rem);
  result(res);


  return 0;
}

Submission Info

Submission Time
Task B - AB Game
User atatomir
Language C++ (GCC 9.2.1)
Score 500
Code Size 505 Byte
Status AC
Exec Time 4 ms
Memory 3552 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 22
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt, 02_handmade_08.txt, 02_handmade_09.txt, 02_handmade_10.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 4 ms 3492 KiB
00_sample_02.txt AC 2 ms 3548 KiB
01_random_01.txt AC 2 ms 3380 KiB
01_random_02.txt AC 2 ms 3500 KiB
01_random_03.txt AC 3 ms 3496 KiB
01_random_04.txt AC 2 ms 3348 KiB
01_random_05.txt AC 2 ms 3508 KiB
01_random_06.txt AC 2 ms 3504 KiB
01_random_07.txt AC 2 ms 3512 KiB
01_random_08.txt AC 2 ms 3348 KiB
01_random_09.txt AC 3 ms 3348 KiB
01_random_10.txt AC 2 ms 3348 KiB
02_handmade_01.txt AC 2 ms 3420 KiB
02_handmade_02.txt AC 2 ms 3492 KiB
02_handmade_03.txt AC 3 ms 3548 KiB
02_handmade_04.txt AC 2 ms 3500 KiB
02_handmade_05.txt AC 2 ms 3416 KiB
02_handmade_06.txt AC 2 ms 3548 KiB
02_handmade_07.txt AC 2 ms 3456 KiB
02_handmade_08.txt AC 2 ms 3492 KiB
02_handmade_09.txt AC 2 ms 3552 KiB
02_handmade_10.txt AC 2 ms 3500 KiB