zoukankan      html  css  js  c++  java
  • Codeforces Round #603 (Div. 2) C.Everyone is A Winner!

    tag里有二分,非常的神奇,我用暴力做的,等下去看看二分的题解

    但是那个数组的大小是我瞎开的,但是居然没有问题233

    #include <cstdio>
    #include <cmath>
    #include <cstring>
    using namespace std;
    const int N = 1e7;
    int c[N];
    int main() {
        int t;
        scanf("%d", &t);
        while (t--) {
            int n;
            scanf("%d", &n);
            int m = sqrt(n) + 1;
            memset(c, 0, sizeof(c));
            int cnt = 0;
            for (int i = 1; i <= m; i++)
                c[cnt++] = n / i;
            while (n >= m) {
                m = n / (n / m) + 1;
                c[cnt++] = n / m;
            }
            printf("%d
    ", cnt);
            for (int i = cnt - 1; i >= 0; i--)
                printf("%d ", c[i]);
            puts("");
        }
        return 0;
    }
  • 相关阅读:
    蓝牙遐想
    BT stack浅入了解
    集合(set)
    字典练习
    数据类型--字典
    数据类型--元组
    字符串
    深浅copy
    python---list
    三种Div高度自适应的方法
  • 原文地址:https://www.cnblogs.com/cminus/p/11963505.html
Copyright © 2011-2022 走看看