import java.util.Scanner; publicclass Main {     public static void main(String[] args) {         Solution s = new Solution();         Scanner sc = new Scanner(System.in);         int t = sc.nextInt();         for(int i = 0; i < t; i++) {             long num = sc.nextLong();             s.getResult(num);         }                  sc.close();     } } class Solution {     public void getResult(long num) {         long dig = 0;         long c = 0;         long i = 1;         while(c < num) {             dig++;             c += i <<= 1;         }         c -= i;         c++;                  long s = num - c;         String result = new String();         for(long k = 0; k < dig; k++) {             if((s & 1l) == 1l) {                 result = "7" + result;             } else {                 result = "4" + result;             }             s >>>= 1;         }         System.out.println(result);     }      } 写的很不好(当时很急)
点赞 13

相关推荐

不愿透露姓名的神秘牛友
08-20 19:41
那一天的Java_J...:简历完全流水账,学生思维很严重,还有很大的优化空间,可以多看看牛客的简历。
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务