//\\__ hr1212 __//\\
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%lld",&a)
#define sii(a,b) scanf("%lld %lld",&a,&b)
#define siii(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
ll n,m;
//(Sn=(n/2)*(2*a+(n-1)*d));
int main(){
ll r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
while(1){
si(m);
if(m==-1)
break;
for(n=2*(int)(sqrt(m));n>=1;n--){
z=(2*m+n-n*n);
y=2*n;
if(z%y==0 && z/y!=0 && z>0 && y>0){
x=z/y;
break;
}
}
printf("%lld = %lld + ... + %lld\n",m,x,x+n-1);
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%lld",&a)
#define sii(a,b) scanf("%lld %lld",&a,&b)
#define siii(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
ll n,m;
//(Sn=(n/2)*(2*a+(n-1)*d));
int main(){
ll r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
while(1){
si(m);
if(m==-1)
break;
for(n=2*(int)(sqrt(m));n>=1;n--){
z=(2*m+n-n*n);
y=2*n;
if(z%y==0 && z/y!=0 && z>0 && y>0){
x=z/y;
break;
}
}
printf("%lld = %lld + ... + %lld\n",m,x,x+n-1);
}
return 0;
}
No comments:
Post a Comment