Worried School HDU-6008 模拟
来源:互联网 发布:阿里云服务器学生1元 编辑:程序博客网 时间:2024/06/06 03:30
原题链接:
HDU-6008
大意:
题目比较长,看的比较麻烦。理解后就是一个简单地模拟。world final 名额有 g 个,g 分为 x + y ,x 的名额从五个站点里依次抽,y 由另一个站 ec-final 里抽。
但是现在不知道 x 和 y ,求某个学校能否进 wf 。能输出 ADVANCED!,否则输出他不能去 wf 的最小 y 值。
思路:
简单模拟。看看样例就懂了
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define mem(s,t) memset(s,t,sizeof(s))#define D(v) cout<<#v<<" "<<v<<endl#define inf 0x3f3f3f3f#define pb push_back#define pair <int,int> pii//#define LOCALconst int MAXN =1e5+10;const int mod=1e9+7;int main() {#ifdef LOCAL freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);#endif int t; scanf("%d",&t); int kase=1; while(t--){ int g; string wa; cin>>g>>wa; string a[10][50]; for(int i=1;i<=5;i++){ for(int j=1;j<=20;j++){ cin>>a[i][j]; } } string fi[50]; for(int i=1;i<=20;i++) cin>>fi[i]; int ret=-1; set<string> ans; for(int x=0;x<=g;x++){ int f1=0,f2=0; int i,j; ans.clear(); if(x>0) for(int r=1;r<=100;r++){ i=r%5;if(i==0) i+=5; j=(int)ceil(r/5.0);//向上取整 ans.insert(a[i][j]); if(a[i][j]==wa) f1=1; if(ans.size()>=x) break; } if(g-x>0) for(int i=1;i<=20;i++){ if(fi[i]==wa) f2=1; ans.insert(fi[i]); if(ans.size()>=g) break; } if(!f1 && !f2) ret=g-x; } if(ret!=-1) printf("Case #%d: %d\n",kase++,ret); else printf("Case #%d: ADVANCED!\n",kase++); } return 0;}
阅读全文
0 0
- Worried School HDU-6008 模拟
- HDU-6008-Worried School
- Worried School HDU
- Problem J. Worried School(日期模拟 STL)
- HDU6008-Worried School
- hdu 4207 Grade School Multiplication
- hdu 1445 Ride to School
- HDU 1445 - Ride to School
- hdu 1445 Ride to School
- POJ 1922 Ride to School 简单模拟
- Csu-1850-Grade School Multiplication [模拟]
- school
- Korea worried
- HDU 1445 Ride to School 贪心
- URAL 2046 The First Day at School(模拟)
- HDU 4207 And SOJ 4198 Grade School Multiplication
- 文章标题 HDU 1445 : Ride to School (贪心)
- (简单模拟2.1.2)POJ 1922 Ride to School(求最小值)
- ContentProvider之系统提供者
- Android NDK 工具链的使用方法(Standalone Toolchain)
- 小黄人的制作
- 654. Maximum Binary Tree
- GitHub使用1
- Worried School HDU-6008 模拟
- 旧文章都删除掉,重新写
- 剑指Offer--4.重建二叉树
- 第一次写博客,还不知道写什么,请大家多多关照
- HDU 6200 mustedge mustedge mustedge [LCT+缩点]
- 用Python爬取百度贴吧中的图片
- Pat(A) 1107. Social Clusters (30)
- Unity 3D学习日记(6)
- 使用Django的认证视图