/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 540.0 KiB
#2 Wrong Answer 56ms 552.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define pb push_back

int chk(int n)
{
    vector<int>samp;
    int p = 1;
    while(p < n)
    {
        if(n%p == 0)
        {
            samp.push_back(p);
        }
        p++;
    }
    return samp.back();
}

void solve(){
    int n, m, k; cin >> n >> m >> k;
    for(int i=0; i<k; i++){
        int x;
        if((n+m)%2==0){
            x=m-1;
        }else{
            x=m;
        }
        n+=x;
        n/=chk(n);
    }
    cout << n << endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; cin >> t;
    while(t--){
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1146 Yet Another Battle Between Roy and Hridoy!
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 07:33:50
Judged At
2024-12-09 07:33:50
Judged By
Score
0
Total Time
56ms
Peak Memory
552.0 KiB