Codeforces Round #603 (Div. 2) C.Everyone is A Winner!

Posted cminus

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
}

 

以上是关于Codeforces Round #603 (Div. 2) C.Everyone is A Winner!的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #603 (Div. 2)

Codeforces Round #603 (Div. 2) E. Editor 线段树

Codeforces Round #603 (Div. 2) A. Sweet Problem(数学)

Codeforces Round #603 (Div. 2) B. PIN Codes

Codeforces Round #603 (Div. 2)

Codeforces Round #603 (Div. 2) F. Economic Difficulties dp