美团除7代码
发布于 2017-09-14 21:49 1685 次浏览 0 赞 来自 试题交流  

最近状态很不行  非常差     不是说代码写不出来  而是自己莫名其妙总是出现低级错误

不知道能A多少   我用java编的  但是粘贴的时候选错了   选成JavaScript了     一直A不出来   到排队交卷的时候才发现

哎  烦!

import java.util.*;

public class MeiTuan {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner sc=new Scanner(System.in);

int ct;

ct=Integer.parseInt(sc.nextLine()) ;

long []arr=new long[ct];

for(int i=0;i<ct;i++) {

arr[i]=sc.nextLong();

}

int count=0;

for(int i=0;i<ct-1;i++) {

for(int j=i+1;j<ct;j++) {

int m=con(arr[i],arr[j]);

int n=con(arr[j],arr[i]);

if(m%7==0) count++;

if(n%7==0) count++;

}

}

System.out.println(count);

}

public static int con(long a,long b) {

int c;

String temp=new String();

temp=temp.valueOf(a)+temp.valueOf(b);

c=Integer.parseInt(temp);

return c;

}

}


添加回复
回到顶部