rt,本人昨天和今天各提交了两三次,为什么总是 UKE?是我的代码有问题还是UVA出现了问题?
本人代码(C++14):
#include <bits/stdc++.h>
using namespace std;
map<int,int,greater<int> > dict;
int main()
{
int k;
while(scanf("%d",&k)==1)
{
int tot=0;
dict.clear();
for(int y=k+1;y<=2*k;y++)
{
int x=(k*y)/(y-k);
if(x<=0)continue;
if((y*k)%(y-k)==0)
{
tot++;
dict[x]=y;
}
}
printf("%d\n",tot);
for(map<int,int>::iterator it=dict.end()-1;it!=dict.begin();it++)
printf("1/%d = 1/%d + 1/%d\n",k,it->first,it->second);
}
return 0;
}