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\n");
18             else printf("No\n");
19         }
20     }
21     return 0;
22 }

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!\n");
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\n",GKP);
25             }
26             if(i!=N){
27                 printf("\n");
28             }
29         }
30     }
31     return 0;
32 }

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("\n");
23             else printf(" ");
24             l--;
25         }
26     }
27     return 0;
28 }

时间: 2024-08-24 14:26:31

hdu2060-2062的相关文章

URAL 2062 Ambitious Experiment(树状数组)

题目地址:http://acm.timus.ru/problem.aspx?space=1&num=2062 思路:对于x位置上的数,对其有贡献的数为位置为x的因数且属于修改区间[l,r]的数.所以对于查询操作ans=a[p]+sigma(sum(j)) (j为p的约数).区间修改时仅需修改区间端点值:c[l]+=d,c[r+1]-=d(当数x在某个无重复区间[l,r]时,每次求前x项的和时已包含该区间即已加上该数贡献,当x>r时,求前x项和时,该区间和为0,即数x贡献为0). #inclu

HDU 2062 Subset sequence 数位dp,思路 难度:1

http://acm.hdu.edu.cn/showproblem.php?pid=2062 Subset sequence Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3569    Accepted Submission(s): 1802 Problem Description Consider the aggregate An=

HDU 2062 Subset sequence

我是把它当做一道数学题来做的. 这篇题解写的有点啰嗦,但是是我最原始的思维过程. 对于一个集合An= { 1, 2, …, n },在n比较小的情况下,在纸上按字典顺序把所有子集排列一下. 以n=3,m=10举例: 1 1 2 1 2 3 1 3 1 3 2 2 2 1 2 1 3 2 3 2 3 1 3 3 1 3 1 2 3 2 3 2 1 n=3的情况 容易看出前5个打头的是1,紧接着5个子集打头的是2,最后5个开头的是3. 拿前五个来说,除了第一个,后面四个不看开头的1,后面的排列形式和

hdu(2062)-Subset sequence 组合数学

题意:求集合{1,2,3...n}的第m个排列子集合.集合的大小按字典树排. 例两个元素的排列子集合按字典树排列是:{1},{1,2},{2},{2,1}: 解法:一个一个元素来确定,每次把剩余的元素按大小顺序排列在num中,然后根据排列组合原理直接计算下一个位置的元素的大小,直到排列数为0停止: 代码: /****************************************************** * author:xiefubao **********************

FZU Problem 2062 Suneast &amp;amp; Yayamao

http://acm.fzu.edu.cn/problem.php?pid=2062 标题效果: 给你一个数n,要求求出用多少个数字能够表示1~n的全部数. 思路: 分解为二进制. 对于一个数n.看它二进制有多少位就可以. #include<cstdio> int main() { int n; while(~scanf("%d",&n)) { int k=0; while(n) { n>>=1; k++; } printf("%d\n&quo

ural 2062 Ambitious Experiment

2062. Ambitious Experiment Time limit: 3.0 secondMemory limit: 128 MB During several decades, scientists from planet Nibiru are working to create an engine that would allow spacecrafts to fall into hyperspace and move there with superluminal velocity

FZU Problem 2062 Suneast &amp; Yayamao

http://acm.fzu.edu.cn/problem.php?pid=2062 题目大意: 给你一个数n,要求求出用多少个数字可以表示1~n的所有数. 思路: 分解为二进制. 对于一个数n,看它二进制有多少位即可. #include<cstdio> int main() { int n; while(~scanf("%d",&n)) { int k=0; while(n) { n>>=1; k++; } printf("%d\n"

POJ 2062 Card Game Cheater

题意:两个人打牌,牌的大小按照2,3,4...9,T,J,Q,K,A排序,如果点数相等就按照H>S>D>C的花色排序.告诉你第一个人的手牌,让你安排第二个人的手牌,使得得分最大(按照顺序依次比较每张牌大小) 1 #include <iostream> 2 #include <algorithm> 3 #include <queue> 4 using namespace std; 5 int dot[300]; 6 int InputNum,NumOfC

hdu 2062 Subset sequence【有点康拓展开的意思】

Subset sequence Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3441    Accepted Submission(s): 1740 Problem Description Consider the aggregate An= { 1, 2, -, n }. For example, A1={1}, A3={1,2,

hdu 2062

ps:11版的最后一题...是个递推题...比如n=5,推出首数字后,n--,继续找下一个 代码: #include "stdio.h" long long c[21]; long long s[21]; int main(){ long long m; int i,j,k,n,t; c[1]=1; for(i=2;i<=20;i++){ c[i]=(i-1)*c[i-1]+1; //c[i]代表n=i时,每组的数量,例如c[2]代表n=2时,每组有2个.. } while(~s