藤原とうふ店 @ 2019-07-17 22:18:56
#include <iostream>
#include <cstdio>
#include <cstring>
#define Maxn 10000009
using namespace std;
char c0[Maxn];
char c1[Maxn],c2[Maxn];
long long n,ans;
int mark;
int main()
{
cin.getline(c0,Maxn); //ÊäÈë
cin>>n;
int len0=strlen(c0);
if(len0>1){
int nn=1;
int maxn;
int a=c0[len0-1]-'0';
ans=a*n;
maxn=Maxn-1;
memset(c1,'0',Maxn);
while(ans>0){
c1[maxn--]=ans%10+48;
ans/=10;
}
for(int i=len0-2;i>EOF;i--){
nn++;
a=c0[i]-'0';
//cout<<a<<endl;
ans=a*n;
maxn=Maxn-nn;
memset(c2,'0',Maxn);
while(ans>0){
c2[maxn--]=ans%10+48;
ans/=10;
}
int j=Maxn-1;
int d,b;
d=0,b=0;
ans=a*n;
int k=nn-1;
while(c1[j]!='0' || c2[j]!='0' || ans>0){
b=c1[j]+c2[j]-'0'-'0'+d;
c1[j]=b%10+'0';
d=b/10;
j--;
(k==0)?ans/=10:k--;
}
c1[j]=d+'0';
mark=j;
}
for(int i=mark+1;i<Maxn;i++){
cout<<c1[i];
}
cout<<endl;
}else{
long long ANS=(c0[0]-'0')*n;
cout<<ANS<<endl;
}
return 0;
}
输入 0 10 输出 0 是对的啊 第一天回坑就炸了……
by 藤原とうふ店 @ 2019-07-17 22:23:39
救救我救救我
by Drunkyous @ 2019-07-17 23:16:23
+1.. 第一个测试点本地也是对的但是咕咕就错了
by 藤原とうふ店 @ 2019-07-18 20:20:13
为何无人救我, 是代码太垃圾了了吗……
by 藤原とうふ店 @ 2019-07-18 20:49:26
#include <iostream>
#include <cstdio>
#include <cstring>
#define Maxn 10000009
using namespace std;
char c0[Maxn];
char c1[Maxn],c2[Maxn];
long long n,ans;
int mark;
int main()
{
cin.getline(c0,Maxn); //ÊäÈë
cin>>n;
int len0=strlen(c0);
for(int i=0;i<len0;i++){
if(c0[i]!='0'){mark=i;break;}
}
for(int i=0;i<len0;i++){
c0[i]=c0[i+mark];
}
len0=strlen(c0);
mark=0;
if(n==0){
cout<<0<<endl;
}else if(len0>1){
int nn=1;
int maxn;
int a=c0[len0-1]-'0';
ans=a*n;
maxn=Maxn-1;
memset(c1,'0',Maxn);
while(ans>0){
c1[maxn--]=ans%10+48;
ans/=10;
}
for(int i=len0-2;i>EOF;i--){
nn++;
a=c0[i]-'0';
//cout<<a<<endl;
ans=a*n;
maxn=Maxn-nn;
memset(c2,'0',Maxn);
while(ans>0){
c2[maxn--]=ans%10+48;
ans/=10;
}
int j=Maxn-1;
int d,b;
d=0,b=0;
ans=a*n;
int k=nn-1;
while(c1[j]!='0' || c2[j]!='0' || ans>0){
b=c1[j]+c2[j]-'0'-'0'+d;
c1[j]=b%10+'0';
d=b/10;
j--;
(k==0)?ans/=10:k--;
}
c1[j]=d+'0';
mark=j;
}
for(int i=mark+1;i<Maxn;i++){
cout<<c1[i];
}
cout<<endl;
}else{
long long ANS=(c0[0]-'0')*n;
cout<<ANS<<endl;
}
return 0;
}
再贴一遍
by 冥诺在线发呆 @ 2019-07-18 21:21:38
@ORINJUO 为什么您n开的是long long,不会爆掉吗
by 藤原とうふ店 @ 2019-07-18 22:13:53
@冥诺在线发呆 哎嘿,没爆,