PE 206 Concealed Square (暴力)

た 入场券 2022-07-13 11:57 126阅读 0赞

Concealed Square

Problem 206

Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0,
where each “_” is a single digit.

题解:

被遮挡的平方数

找出唯一一个其平方形如1_2_3_4_5_6_7_8_9_0的正整数,
其中每个“_”表示一位数字。

题解:

额….暴力呗…

代码:

  1. #include<bits/stdc++.h>
  2. int check(long long num)
  3. {
  4. num = num * num;
  5. num /= 100;
  6. for (int i = 9; i >= 1; i--)
  7. {
  8. if (num % 10 == i) num /= 100;
  9. else return 0;
  10. }
  11. return 1;
  12. }
  13. int main()
  14. {
  15. for (long long i = 1000000070; i < 2000000000; i += 100)
  16. {
  17. if (check(i))
  18. {
  19. printf("%lld\n", i);
  20. break;
  21. }
  22. }
  23. return 0;
  24. }

发表评论

表情:
评论列表 (有 0 条评论,126人围观)

还没有评论,来说两句吧...

相关阅读

    相关 PE1-什么是pe

    PE是什么? PE即 Portable Executable(可移植的执行体)。它是 Win32环境自身所带的执行体文件格式。它的一些特性继承自 Unix的 Coff 文