Submission #17457161


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007 
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}

int main() {
   fast();
   long long x,y,a,b;
   cin>>x>>y>>a>>b;
   long long int score=0;
   while(x<y){
      if(x<=(x+b)/a){
        score++;
        if(x>=y/a){
            
            score--;
            break;
        }
        x*=a;
      }else{
          if((y-x)%b==0){
              score+=(y-x)/b-1;
          }else{
              score+=(y-x)/b;
          }
        
        break;
      }
   }
   cout<<score<<"\n";


}

Submission Info

Submission Time
Task D - Takahashi Unevolved
User rocww
Language C++ (GCC 9.2.1)
Score 400
Code Size 704 Byte
Status AC
Exec Time 8 ms
Memory 3648 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 31
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, max_01.txt, max_02.txt, max_03.txt, max_04.txt, max_05.txt, max_06.txt, max_07.txt, max_08.txt, max_09.txt, max_10.txt, max_11.txt, max_12.txt, max_13.txt, max_14.txt, max_15.txt, max_16.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 8 ms 3604 KB
max_01.txt AC 2 ms 3536 KB
max_02.txt AC 5 ms 3540 KB
max_03.txt AC 4 ms 3520 KB
max_04.txt AC 3 ms 3560 KB
max_05.txt AC 3 ms 3536 KB
max_06.txt AC 3 ms 3580 KB
max_07.txt AC 2 ms 3636 KB
max_08.txt AC 3 ms 3520 KB
max_09.txt AC 2 ms 3608 KB
max_10.txt AC 3 ms 3536 KB
max_11.txt AC 2 ms 3472 KB
max_12.txt AC 2 ms 3468 KB
max_13.txt AC 3 ms 3472 KB
max_14.txt AC 6 ms 3512 KB
max_15.txt AC 2 ms 3576 KB
max_16.txt AC 3 ms 3644 KB
random_01.txt AC 3 ms 3532 KB
random_02.txt AC 2 ms 3636 KB
random_03.txt AC 2 ms 3536 KB
random_04.txt AC 2 ms 3576 KB
random_05.txt AC 2 ms 3596 KB
random_06.txt AC 2 ms 3484 KB
random_07.txt AC 5 ms 3628 KB
random_08.txt AC 7 ms 3576 KB
random_09.txt AC 3 ms 3576 KB
random_10.txt AC 3 ms 3524 KB
random_11.txt AC 2 ms 3528 KB
random_12.txt AC 3 ms 3600 KB
sample_01.txt AC 2 ms 3648 KB
sample_02.txt AC 2 ms 3536 KB