解题思路:
完全数好像真的很少,,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语言代码)浏览:660 |
点我有惊喜!你懂得!浏览:1236 |
简单的a+b (C语言代码)浏览:548 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:1518 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:559 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:553 |
简单的a+b (C语言代码)浏览:596 |
1908题解浏览:639 |
模拟计算器 (C++代码)浏览:804 |
DNA (C语言代码)浏览:736 |