Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define MAX 10000
- using namespace std;
- vector<int> p;
- void build(int max){
- int a = 0;
- for( int i = 1 ; i < max ; i++ ) {
- a += i;
- p.push_back( a );
- }
- }
- int main(){
- build( MAX );
- int t , n;
- cin >> t;
- while( t-- ){
- cin >> n;
- for( int i = 0 ; i < MAX ; i ++ ){
- if( n == p[i] ) {
- cout << i + 2 << ' ' << i + 2 << endl;
- break;
- }
- else if( n < p[i] ) {
- cout << p[i] - n << ' ' << i + 1 << endl;
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement