zoukankan      html  css  js  c++  java
  • 2016年第七届蓝桥杯C/C++ C组国赛 —— 第一题:平方末尾

    平方末尾

    能够表示为某个整数的平方的数字称为“平方数”
    比如,25,64
    虽然无法立即说出某个数是平方数,但经常可以断定某个数不是平方数。
    因为平方数的末位只可能是:[0, 1, 4, 5, 6, 9] 这6个数字中的某个。
    所以,4325435332必然不是平方数。

    如果给你一个2位或2位以上的数字,你能根据末位的两位来断定它不是平方数吗?

    请计算一下,一个2位以上的平方数的最后两位有多少种可能性?

    注意:需要提交的是一个整数,表示2位以上的平方数最后两位的不同情况数。
    不要填写任何多余内容(比如,说明解释文字等)

    Code

    /*
                                    ^....0
                                   ^ .1 ^1^
                                   ..     01
                                  1.^     1.0
                                 ^ 1  ^    ^0.1
                                 1 ^        ^..^
                                 0.           ^ 0^
                                 .0            1 .^
                                 .1             ^0 .........001^
                                 .1               1. .111100....01^
                                 00                 11^        ^1. .1^
                                 1.^                              ^0  0^
                                   .^                                 ^0..1
                                   .1                                   1..^
                                 1 .0                                     ^  ^
                                  00.                                     ^^0.^
                                  ^ 0                                     ^^110.^
                              0   0 ^                                     ^^^10.01
                       ^^     10  1 1                                      ^^^1110.1
                       01     10  1.1                                      ^^^1111110
                       010    01  ^^                                        ^^^1111^1.^           ^^^
                       10  10^ 0^ 1                                            ^^111^^^0.1^       1....^
                        11     0                                               ^^11^^^ 0..  ....1^   ^ ^
                        1.     0^                                               ^11^^^ ^ 1 111^     ^ 0.
                       10   00 11                                               ^^^^^   1 0           1.
                       0^  ^0  ^0                                                ^^^^    0            0.
                       0^  1.0  .^                                               ^^^^    1 1          .0
                       ^.^  ^^  0^                             ^1                ^^^^     0.         ^.1
                       1 ^      11                             1.                ^^^     ^ ^        ..^
                      ^..^      ^1                             ^.^               ^^^       .0       ^.0
                      0..^      ^0                              01               ^^^       ..      0..^
                     1 ..        .1                             ^.^              ^^^       1 ^  ^0001
                    ^  1.        00                              0.             ^^^        ^.0 ^.1
                    . 0^.        ^.^                             ^.^            ^^^         ..0.0
                   1 .^^.         .^                  1001        ^^            ^^^         . 1^
                   . ^ ^.         11                0.    1         ^           ^^          0.
                    0  ^.          0              ^0       1                   ^^^          0.
                  0.^  1.          0^             0       .1                   ^^^          ..
                  .1   1.          00            .        .1                  ^^^           ..
                 1      1.         ^.           0         .^                  ^^            ..
                 0.     1.          .^          .         0                                  .
                 .1     1.          01          .        .                                 ^ 0
                ^.^     00          ^0          1.       ^                                 1 1
                .0      00           .            ^^^^^^                                   .
                .^      00           01                                                    ..
               1.       00           10                                                   1 ^
              ^.1       00           ^.                                            ^^^    .1
              ..        00            .1                                        1..01    ..
             1.1         00           1.                                       ..^      10
            ^ 1^         00           ^.1                                      0 1      1
            .1           00            00                                       ^  1   ^
             .           00            ^.^                                        10^  ^^
           1.1           00             00                                              10^
           ..^           1.             ^.                                               1.
          0 1            ^.              00                 00                            .^
            ^            ^.              ^ 1                00   ^0000^     ^               01
         1 0             ^.               00.0^              ^00000   1.00.1              11
         . 1              0               1^^0.01                      ^^^                01
          .^              ^                1   1^^                                       ^.^
        1 1                                                                              0.
        ..                                                                              1 ^
         1                                                                               1
       ^ ^                                                                             .0
       1                                                                             ^ 1
       ..                                                          1.1            ^0.0
      ^ 0                                                           1..01^^100000..0^
      1 1                                                            ^ 1 ^^1111^ ^^
      0 ^                                                             ^ 1      1000^
      .1                                                               ^.^     .   00
      ..                                                                1.1    0.   0
      1.                                                                  .    1.   .^
      1.                                                                 1    1.   ^0
     ^ .                                                                 ^.1 00    01
     ^.0                                                                  001.     .^
     */
    // VB_king —— 2016_Finals_C_C++_1.cpp created by VB_KoKing on 2019-05-13:08.
    /* Procedural objectives:
    
     Variables required by the program:
    
     Procedural thinking:
    
     Functions required by the program:
     
     Determination algorithm:
     
     Determining data structure:
     
    
    */
    /* My dear Max said:
    "I like you,
    So the first bunch of sunshine I saw in the morning is you,
    The first gentle breeze that passed through my ear is you,
    The first star I see is also you.
    The world I see is all your shadow."
    
    FIGHTING FOR OUR FUTURE!!!
    */
    #include <iostream>
    #include <cstring>
    
    using namespace std;
    
    int main() {
        int num_2[100], ans = 0;
        memset(num_2, 0, sizeof(num_2));
        for (long long i = 1; i < 1000000; i++)
            num_2[(i * i) % 100]++;
        for (int i = 0; i < 100; i++)
            if (num_2[i]) ans++;
        cout << ans << endl;
        return 0;
    }
    
  • 相关阅读:
    SGA_MAX_SIZE,SGA_TARGET以及PRE_PAGE_SGA参数
    关于DataPump的external_table模式
    undo backup optimization does not work on 11.2.0.1?
    发一个Oracle Dba招聘启事
    ORA600[4194]错误一例
    ORA00600: internal error code, arguments: [kdsgrp1] example
    Pending Problem
    如何修复重编译Datapump工具expdp/impdp
    Mysql:备份、还原、恢复:Mysqldump——标准免费的通用备份工具
    Mysql:SQL语句:DDL语句
  • 原文地址:https://www.cnblogs.com/AlexKing007/p/12338309.html
Copyright © 2011-2022 走看看