zoukankan      html  css  js  c++  java
  • 全加和 (How do you add?,UVa 10943)

     1 #include <iostream>
     2 #include <string.h>
     3 #include <string>
     4 #include <fstream>
     5 #include <algorithm>
     6 #include <stdio.h>
     7 #include <vector>
     8 #include <queue>
     9 #include <set>
    10 #include <cmath>
    11 using namespace std;
    12 const double eps = 1e-8;
    13 const int INF=0x7fffffff;
    14 #define MAXN 10000002
    15 typedef int LL;
    16 int vis[MAXN];
    17 int prime[700000];
    18 
    19 void sieve(int n)
    20 {
    21     int m=(int)sqrt(n+0.5);
    22     memset(vis,0,sizeof(vis));
    23     for(int i=2;i<=m;i++)if(!vis[i])
    24     for(int j=i*i;j<=n;j+=i)vis[j]=1;
    25 }
    26 
    27 int gen_prime(int n)
    28 {
    29     sieve(n);
    30     int c=0;
    31     for(int i=2;i<=n;i++)if(!vis[i])
    32         prime[c++]=i;
    33     return c;
    34 }
    35 
    36 LL gcd(LL a,LL b)
    37 {
    38     return b==0?a:gcd(b,a%b);
    39 }
    40 LL d[101][101];
    41 LL p[101];
    42 int main()
    43 {
    44     LL N,K;
    45     for(LL i=0;i<=100;i++)
    46     {d[i][1]=1;if(i)p[i]=p[i-1]+1;else p[i]=1;}
    47     for(LL k=2;k<=100;k++)
    48     for(LL n=0;n<=100;n++)
    49     {
    50         d[n][k]=p[n];
    51         if(n)p[n]=(p[n-1]+d[n][k])%1000000;
    52         else p[n]=d[n][k];
    53     }
    54     while(scanf("%d%d",&N,&K),N+K!=0)
    55     {
    56         printf("%d
    ",d[N][K]);
    57     }
    58     return 0;
    59 }

    预处理~

  • 相关阅读:
    二次冲刺站立会议五
    二次冲刺站立会议四
    二次冲刺站立会议三
    二次冲刺站立会议二
    自己常用网址导航
    Eclipse几个配置
    JVM参数和jvm.log
    JVM性能监控命令
    Linux基本信息查看命令
    Linux IO性能监控工具
  • 原文地址:https://www.cnblogs.com/TO-Asia/p/3203753.html
Copyright © 2011-2022 走看看