ccf201712-2游戏问题本地测试成功了,可是得分为0……



我用java写的,本地测试都没问题,可是提交以后得分为0,时间内存都没超……,求各位大佬帮忙解答一下
```
 import java.util.Scanner;


public class Main {


public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int k=sc.nextInt();
int[] order=new int[n];
for (int i = 0; i < n; i++) {
order[i]=i+1;
}

String orderStr="";
for (int i = 0; i < order.length; i++) {
orderStr+=order[i]%10;
}

int count=0;
while(count<n-1){
for (int i = 0; i < order.length; i++) {
if(order[i]%k==0&&order[i]!=0){
count++;
order[i]=0;
orderStr=orderStr.replace(orderStr.charAt(i),'0');
}
else
if(order[i]%10==k){
count++;
order[i]=0;
orderStr=orderStr.replace(orderStr.charAt(i),'0');
}
else
order[i]+=(n-count);
}
}

for (int i = 0; i < orderStr.length(); i++) {
if(orderStr.charAt(i)!='0')
System.out.println(Integer.parseInt(orderStr.charAt(i)+""));
}
}
}


}


```

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页