1404:我家的门牌号

#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<cstring>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int i,j;
    for(i=2;i<=1000;i++)
    {
        for(j=2;j<=i;j++)
            if(i*(i+1)-6*j==2*n)
                printf("%d %d",j,i);
    }
    return 0;
}100'
 

猜你喜欢

转载自blog.csdn.net/qq_42552468/article/details/81160231