Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
2,056 views
For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in
in Online Assessments by Expert (44,360 points)

1 Answer

0 like 0 dislike

Images of ques

imageimage

 

by Expert (44,360 points)
0 0
#include<bits/stdc++.h>
using namespace std;


int main(){

    int n;
    cin >> n;
    int t;
    cin >> t;
    int temp = n-1;
    int div = t/temp;
    int f = 0;
    int mod = t%temp;
    if(div % 2 == 0 || (div%2 && t%temp==0)){
        f = 0;
    }
    else{
        f = 1;
    }
    if(f == 0){
        if(mod != 0){
            cout << mod << " " << mod+1<<endl;
        }
        else{
            cout << temp << " " << temp+1 << endl;
        }
    }
    else{
        if(mod != 0){
            cout << n-mod+1 << " " << n -mod<<endl;
        }
        else{
            cout << 2 << " " << 1 << endl;
        }
    }

    return 0;
}



//I think this code should work for hidden cases as well.
...