luogu part 1.1 Cantor 表 (基础题)

P1014
O(√n)


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
int main(){
    
    
	int n,l=0,i=0;
	cin>>n;
	while(n>l){
    
    
		i++;
		l+=i;
	}
	if(i%2==0)cout<<n+i-l<<"/"<<l-n+1;
	else cout<<l-n+1<<"/"<<n+i-l;
	return 0;
	
}

猜你喜欢

转载自blog.csdn.net/Minelois/article/details/113666984
今日推荐