解题思路:
完全数好像真的很少,,6,28,496,8128,33550336,,目测只会考前四个,,,剩下的估计正常算1s之内跑不完程序,,所以无脑直接输出啊hhhhhhh
注意事项:
出乎意料的,,竟然测试数据有大于8128的hhhhhhhhhh
参考代码:
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { if (n >= 6) printf("6 its factors are 1 2 3\n"); if (n >= 28) printf("28 its factors are 1 2 4 7 14\n"); if (n >= 496) printf("496 its factors are 1 2 4 8 16 31 62 124 248\n"); if (n >= 8128) printf("8128 its factors are 1 2 4 8 16 32 64 127 254 508 1016 2032 4064\n"); } return 0; }
0.0分
15 人评分
C语言训练-求函数值 (C语言代码)浏览:910 |
C语言训练-计算1~N之间所有奇数之和 (C语言代码)浏览:719 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:572 |
C语言训练-求函数值 (C语言代码)浏览:931 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:742 |
字符串对比 (C语言代码)浏览:1397 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:480 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:609 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:484 |
1054题解浏览:460 |