| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么我的代码总是WA!!进来看看吧~#include<iostream>
#include<math.h>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
int f,r,len,temp,i;
char s,v[5000]={0};
while(cin>>f) //读第一个数
{
s=getchar();//读‘-’符
cin>>r;
len=(int)log10(double(r-f-1))+1;
temp=len;
for(i=0;i<len;i++)
{
v[i]=r%10+'0';
r=r/10;
}
cout<<f<<"-";
for(i=len-1;i>=0;i--)
cout<<v[i];
cout<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator