关注
这种暴力代码10%是不是就是因为时间不够了 public class test3 { public static boolean check(int m) { String reslut=Integer.toBinaryString(m); StringBuffer sb= new StringBuffer(reslut); sb.reverse(); int count=0; for(int i=0;i<reslut.length();i++) { if(reslut.charAt(i)==sb.charAt(i)) { count++; } } if(count==reslut.length()) { return true; }else { return false; } } public static void test(int n) { if(n<1 || n>Math.pow(10, 10)) { return; } int temp=0; for(int i=0;i<=n;i++) { if(check(i)) { temp++; } } System.out.println(temp); } public static void main(String[] args) { Scanner s= new Scanner(System.in); while(true) { int n= s.nextInt(); test(n); } } }
查看原帖
点赞 评论
牛客热帖
更多
正在热议
更多
# xx岗简历求拷打 #
12085次浏览 125人参与
# 如何看待offer收割机的行为 #
1048367次浏览 6603人参与
# 开工第一帖 #
41748次浏览 807人参与
# 掌握什么AI技能,会为你的求职大大加分 #
10027次浏览 407人参与
# 有转正机会的小厂实习值得去吗? #
10129次浏览 106人参与
# 携程求职进展汇总 #
891550次浏览 5905人参与
# 机械人还在等华为开奖吗? #
316284次浏览 1586人参与
# 互联网回暖,腾讯要招5000人! #
25276次浏览 597人参与
# 面试反问你会问什么 #
169430次浏览 1744人参与
# 联想求职进展汇总 #
335415次浏览 2224人参与
# 制造业的秋招小结 #
145034次浏览 2095人参与
# 被说“做题家”,你的反应是_____? #
12652次浏览 165人参与
# 金三银四,你有感觉到吗 #
696249次浏览 6096人参与
# 你最讨厌面试被问什么 #
10458次浏览 117人参与
# 工作不开心辞职是唯一出路吗 #
10151次浏览 40人参与
# 求职季如何保持心态不崩 #
213929次浏览 1469人参与
# 远程面试的尴尬瞬间 #
329036次浏览 1918人参与
# 面试题刺客退退退 #
536148次浏览 7533人参与
# 哪些公司开春招了? #
35396次浏览 210人参与
# 牛客租房专区 #
162395次浏览 1997人参与