zoukankan      html  css  js  c++  java
  • hdu2060-2062

    hdu 2060 

    斯诺克,读懂题意直接模拟

     1 #include<stdio.h>
     2 
     3 int main(){
     4     int N;
     5     int i,a[21];
     6     a[0]=0;
     7     for(i=1;i<=6;i++){
     8         a[i]=(15-i)*i/2;
     9     }
    10     for(i=7;i<=21;i++){
    11         a[i]=a[i-1]+8;
    12     }
    13     while(scanf("%d",&N)!=EOF){
    14         for(i=1;i<=N;i++){
    15             int L,SP,SO;
    16             scanf("%d%d%d",&L,&SP,&SO);
    17             if(a[L]>=SO-SP) printf("Yes
    ");
    18             else printf("No
    ");
    19         }
    20     }
    21     return 0;
    22 }
    View Code

    hdu 2061

    求GPA并判断有没有挂科,直接模拟

     1 #include<stdio.h>
     2 #include<string.h>
     3 int main(){
     4     int N;
     5     while(scanf("%d",&N)!=EOF){
     6         for(int i=1;i<=N;i++){
     7             int K,j;
     8             scanf("%d",&K);
     9             double C[100],S[100];
    10             char q[100];
    11             bool f=0;
    12             for(j=1;j<=K;j++){
    13                 scanf("%s%lf%lf",q,&C[j],&S[j]);
    14                 if(!f&&S[j]<60&&S[j]>=0)f=1;
    15             }
    16             if(f)printf("Sorry!
    ");
    17             else{
    18                 double GKP=0,s=0;
    19                 for (j=1;j<=K;j++){
    20                     GKP+=S[j]*C[j];
    21                     s+=C[j];
    22                 }
    23                 GKP=GKP*1.0/s;
    24                 printf("%.2lf
    ",GKP);
    25             }
    26             if(i!=N){
    27                 printf("
    ");
    28             }
    29         }
    30     }
    31     return 0;
    32 }
    View Code

    hdu2062

     1 #include<stdio.h>
     2 #include<string.h>
     3 int main()
     4 {
     5     long long a[21],i;
     6     a[1]=1;
     7     for(i=2;i<=20;i++) a[i]=(i-1)*a[i-1]+1;
     8     long long n,m;
     9     while(scanf("%I64d%I64d",&n,&m)!=EOF){
    10         long long b[21],k=m,l=n,t,s;
    11         memset(b,0,sizeof(b));
    12         for(;k>0;){
    13             t=(k-1)/a[l]+1;
    14             s=0;
    15             for (t;t>0;t--){
    16                 s++;
    17                 while (b[s]) s++;
    18             }
    19             b[s]=1;
    20             printf("%I64d",s);
    21             k=(k-1)%a[l];
    22             if (k==0) printf("
    ");
    23             else printf(" ");
    24             l--;
    25         }
    26     }
    27     return 0;
    28 }
    View Code
  • 相关阅读:
    网上流行的学生选课相关的50个常用sql语句
    the interview questions of sql server
    ASP.NET 之 Chart Control for .Net Framework
    SQL Server之纵表与横表互转
    ASP.NET控件之RadioButtonList
    SQL Server通过钉钉机器人直接发送消息
    使用AMO对象,更改款属性名称
    常用MDX函数
    Excel 插入图片
    Sql Server 2008查询数据库中各表记录行数
  • 原文地址:https://www.cnblogs.com/cenariusxz/p/6577930.html
Copyright © 2011-2022 走看看