我个人认为可能是你i<=k/2错了
by xhyf77 @ 2019-05-06 18:04:41
我觉得你可以用个变量来计你离答案还差多少,当这个变量等于0时你break就OK了,我觉得这样应该更不会错吧
by xhyf77 @ 2019-05-06 18:05:28
@[茶狮](/space/show?uid=164309) 当K等于36时也要return
by xhyf77 @ 2019-05-06 18:07:16
```cpp
#include<bits/stdc++.h>
using namespace std;
long long k;
int m;
int main(){
cin>>k;
if(k>=36){
cout<<-1;
return 0;
}
while(k!=0){
if(k>=2) cout<<8,k-=2;
else cout<<4,k-=1;
}
}
by xhyf77 @ 2019-05-06 18:09:13
@[futongxue](/space/show?uid=116658) 我这个wa了最后一个,发错了
by xhyf77 @ 2019-05-06 18:09:37
CodeForces测试#3
Input:3
Jury's answer:86
这个点我WA了,程序输出8
by 茶狮 @ 2019-05-06 18:15:28
```cpp
#include<bits/stdc++.h>
using namespace std;
long long k;
int m;
int main(){
cin>>k;
if(k>36){
cout<<-1;
return 0;
}
if(k==0){cout<<1;return 0;}
while(k!=0){
if(k>=2) cout<<8,k-=2;
else cout<<4,k-=1;
}
}
by xhyf77 @ 2019-05-06 18:15:38
@[茶狮](/space/show?uid=164309) >36 break掉,我说错了
by xhyf77 @ 2019-05-06 18:16:05
@[futongxue](/space/show?uid=116658) 我直接return 0了不用break呀
by 茶狮 @ 2019-05-06 18:17:14
@[茶狮](/space/show?uid=164309) okok,我再看看
by xhyf77 @ 2019-05-06 18:18:37