题解

144 条题解

  • -1
    @ 2016-03-22 07:16:17

    测试数据 #0: Accepted, time = 0 ms, mem = 552 KiB, score = 10

    测试数据 #1: Accepted, time = 0 ms, mem = 552 KiB, score = 10

    测试数据 #2: Accepted, time = 0 ms, mem = 552 KiB, score = 10

    测试数据 #3: Accepted, time = 0 ms, mem = 552 KiB, score = 10

    测试数据 #4: Accepted, time = 0 ms, mem = 552 KiB, score = 10

    测试数据 #5: Accepted, time = 0 ms, mem = 552 KiB, score = 10

    测试数据 #6: Accepted, time = 0 ms, mem = 548 KiB, score = 10

    测试数据 #7: Accepted, time = 0 ms, mem = 548 KiB, score = 10

    Accepted, time = 0 ms, mem = 552 KiB, score = 80

  • -1
    @ 2015-07-29 11:26:23

    评测结果
    编译成功

    foo.cpp: In function 'int main()':
    foo.cpp:10:24: warning: unknown conversion type character 'l' in format [-Wformat=]
    scanf("%lld%lld",&n,&k);
    ^
    foo.cpp:10:24: warning: unknown conversion type character 'l' in format [-Wformat=]
    foo.cpp:10:24: warning: too many arguments for format [-Wformat-extra-args]
    foo.cpp:30:23: warning: unknown conversion type character 'l' in format [-Wformat=]
    printf("%lld ",now);
    ^
    foo.cpp:30:23: warning: too many arguments for format [-Wformat-extra-args]
    foo.cpp:42:17: warning: unknown conversion type character 'l' in format [-Wformat=]
    printf("%lld",i);
    ^
    foo.cpp:42:17: warning: too many arguments for format [-Wformat-extra-args]
    测试数据 #0: Accepted, time = 0 ms, mem = 280 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 280 KiB, score = 10
    测试数据 #2: Accepted, time = 0 ms, mem = 276 KiB, score = 10
    测试数据 #3: Accepted, time = 15 ms, mem = 280 KiB, score = 10
    测试数据 #4: Accepted, time = 0 ms, mem = 280 KiB, score = 10
    测试数据 #5: Accepted, time = 15 ms, mem = 280 KiB, score = 10
    测试数据 #6: Accepted, time = 0 ms, mem = 280 KiB, score = 10
    测试数据 #7: Accepted, time = 15 ms, mem = 276 KiB, score = 10
    Accepted, time = 45 ms, mem = 280 KiB, score = 80
    代码
    #include <iostream>
    #include <stdio.h>
    using namespace std;
    int num[30];
    unsigned long long a[25]={0,0,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,121645100408832000,2432902008176640000};

    int main()
    {
    long long n,k;
    scanf("%lld%lld",&n,&k);
    k--;
    for(long long i=n;i>1;i--)
    {

    long long j=k/a[i];
    k%=a[i];
    long long now=1;
    long long total=0;
    for(;;)
    {
    if(num[now]==1)
    {
    now++;
    continue;
    }

    else
    if(total==j)
    {
    num[now]=1;
    printf("%lld ",now);
    break;
    }
    else
    total++;
    now++;
    }
    }
    for(long long i=1;i<=n;i++)
    if(!num[i])
    {
    printf("%lld",i);
    return 0;
    }
    }

  • -1
    @ 2015-02-01 14:58:32

    /*************************************************************************
    > File Name: d.c
    > Author: Netcan
    > Mail: 1469709759@qq.com
    > Created Time: 2015/2/1 11:44:00
    ************************************************************************/

    #include<stdio.h>

    #include<string.h>

    const long long fac[21]={1,1,2,6,24,120,720,5040,40320,362880,
    3628800,39916800,479001600,6227020800,
    87178291200,1307674368000,20922789888000,
    355687428096000,6402373705728000,121645100408832000,
    2432902008176640000};
    bool flag[21];
    int f(int *data, int n, int m) {
    int t;
    memset(flag, 0, sizeof(flag));
    --m;
    for(int i = 0; i < n; ++i) {
    t = m / fac[n - i - 1];
    int j;
    for(j = 1; j <= n; ++j)
    if(!flag[j]) {
    if(0 == t) break;
    else --t;
    }
    data[i] = j, flag[j] = true;
    m %= fac[n - i -1];
    }
    }

    int main()
    {
    int n,m;
    int data[21];
    while(scanf("%d%d",&n,&m)==2) {
    f(data, n, m);
    int flag = true;
    for(int i = 0; i<n; ++i)
    if(flag) {
    printf("%d", data[i]);
    flag=false;
    }
    else
    printf(" %d", data[i]);
    puts("");
    }

    return 0;
    }

  • -1
    @ 2009-09-20 14:13:19

    在C语言里用int和long 都存不下20!

    无奈之下,用了double

    一次AC!!!!!

    贴下程序(有更改,不能直接提交,请管理员不必删)

    #include

    double jiech[21]={1};

    long number,locate,last[20]={};

    main()

    {

    long i,j=0;

    for(i=1;i

信息

ID
1092
难度
5
分类
组合数学 点击显示
标签
(无)
递交数
4526
已通过
1400
通过率
31%
被复制
11
上传者