http://acm.hdu.edu.cn/showproblem.php?pid=4782
题意: # 将格式混乱的html代码输出成标准格式。
题目链接
题意:初始有一个锅,每t分钟可以做好k个饼,现在需要N个饼。还可以另外建一个锅,花费d时间,建好以后两个锅可以并行烙饼。问是否应该建锅?(以期减少烙饼时间)
#1197 : Give My Text Back # 时间限制:10000ms
题目链接
题意:求一个小数的循环节…
思路:其实直接模拟就好…
题意:一串电话号码,每个数字+8取各位后,把每个数字写成对应的大写英文,从"ZERO"和“NINE”,然后打乱字母的顺序。现在给出打乱的字母顺序,问可能的字典序最小的电话号码是是多少(可能有前导0)
hdu 5835 题目链接 题意:n种礼物,每种a[i]个。现在有无穷个小朋友排成一排,分给每个人一个“普通”的礼物,一个“昂贵”的礼物(哪个普通哪个昂贵是自己定的,或者说,任意的) 要求是相邻的小朋友的普通的礼物不能是同一种。现在问最多能给多少小朋友分礼物。。。
题目链接 傻逼模拟。。读完题就ac了。。。
1/* *********************************************** 2Author :111qqz 3Created Time :2016年08月07日 星期日 18时04分18秒 4File Name :code/whust2016/#1/D.cpp 5************************************************ */ 6#include <cstdio> 7#include <cstring> 8#include <iostream> 9#include <algorithm> 10#include <vector> 11#include <queue> 12#include <stack> 13#include <set> 14#include <map> 15#include <string> 16#include <cmath> 17#include <cstdlib> 18#include <deque> 19#include <ctime> 20#define fst first 21#define sec second 22#define lson l,m,rt<<1 23#define rson m+1,r,rt<<1|1 24#define ms(a,x) memset(a,x,sizeof(a)) 25typedef long long LL; 26#define pi pair < int ,int > 27#define MP make_pair 28using namespace std; 29const double eps = 1E-8; 30const int dx4[4]={1,0,0,-1}; 31const int dy4[4]={0,-1,1,0}; 32const int inf = 0x3f3f3f3f; 33const int N=280; 34int n,m; 35int total,adva,advb; 36struct Friend 37{ 38 int money; 39 int adv; 40}f[N]; 41struct Room 42{ 43 int type; 44 int cost; 45 int adv; 46}r[N]; 47struct Ans 48{ 49 int val; 50 int rid; 51 int fid; 52 bool operator < (Ans b)const 53 { 54 return val>b.val; 55 } 56}ans[300*300]; 57int main() 58{ 59 #ifndef ONLINE_JUDGE 60 freopen("code/in.txt","r",stdin); 61 #endif 62 cin>>total>>adva>>advb; 63 cin>>n; 64 for ( int i = 1 ; i <= n ; i++) 65 scanf("%d %d",&f[i].money,&f[i].adv); 66 scanf("%d",&m); 67 for ( int i = 1 ; i <= m ; i++) 68 scanf("%d%d%d",&r[i].type,&r[i].cost,&r[i].adv); 69 int cnt = 0 ; 70 for ( int i = 1 ; i <= m ; i++) 71 { 72 if (r[i].type==1) 73 { 74 if (r[i].cost<=total) 75 { 76 cnt++; 77 ans[cnt].val = r[i].adv+adva; 78 ans[cnt].rid = i; 79 ans[cnt].fid = -1; 80 } 81 continue; 82 } 83 else 84 { 85 for ( int j = 0 ; j <= n ; j++) 86 { 87 if (j==0) //自己住双人间 88 { 89 if (r[i].cost<=total) 90 { 91 cnt++; 92 ans[cnt].val = r[i].adv+advb; 93 ans[cnt].rid = i ; 94 ans[cnt].fid = -1; 95 } 96 } 97 else 98 { 99 if (r[i].cost<=total*2&&r[i].cost<=f[j].money*2) 100 { 101 cnt++; 102 ans[cnt].val = r[i].adv+f[j].adv; 103 ans[cnt].rid = i ; 104 ans[cnt].fid = j; 105 } 106 } 107 } 108 } 109 } 110// for ( int i = 1 ; i <= cnt ; i++) 111// { 112// printf("val:%d room: %d friend : %d \n",ans[i].val,ans[i].rid,ans[i].fid); 113// } 114 if (cnt==0) 115 { 116 puts("Forget about apartments. Live in the dormitory."); 117 }else 118 { 119 sort(ans+1,ans+cnt+1); 120 if (r[ans[1].rid].type==1) 121 { 122 printf("You should rent the apartment #%d alone.\n",ans[1].rid); 123 } 124 else 125 { 126 if (ans[1].fid==-1) 127 { 128 printf("You should rent the apartment #%d alone.\n",ans[1].rid); 129 } 130 else 131 { 132 133 printf("You should rent the apartment #%d with the friend #%d.\n",ans[1].rid,ans[1].fid); 134 135 } 136 } 137 } 138 #ifndef ONLINE_JUDGE 139 fclose(stdin); 140 #endif 141 return 0; 142}
cf689A
思路:一个老式的电话键盘。。。。给出一个拨号的移动路径。。。问这个路径是否唯一。
1689: [Usaco2005 Open] Muddy roads 泥泞的路 # Time Limit: 5 Sec Memory Limit: 64 MB Submit: 311 Solved: 227 [Submit][Status][Discuss]
# Time Limit: 5 Sec Memory Limit: 64 MB Submit: 774 Solved: 593 [Submit][Status][Discuss]
Description # Farmer John有一个过时的打谷机(收割小麦),它需要带子来带动。发动机驱动轮1总是顺时针旋转的,用来带动转轮2,转轮2来带动转轮3,等等。一共有n(2<=n<=1000)个转轮(n-1条带子)。上面的图解描述了转轮的两种连接方式,第一种方式使得两个轮子旋转的方向相同,第二种则相反。 给出一串带子的信息: *Si—驱动轮 *Di—被动轮 *Ci—连接的类型(0=直接连接,1=交叉连接) 不幸的是,列出的信息是随即的。 作为样例,考虑上面的图解,n=4,转轮1是驱动轮,可以得知最后转轮4是逆时针旋转的。
http://acm.hdu.edu.cn/showproblem.php?pid=5611 题意:给出n个电话号码(长度为11的字符串),满足特殊条件的价格为a,否则为b.特殊条件为最后5位数字一样,最后5位严格递增或者严格递减,最后8位是一个1980年1月一日到2016年12月31日的合法日期。问最后的价值。
http://codeforces.com/contest/611/problem/C 题意:给出一个n*m的地图,.表示可以空,#表示墙。一个东西需要占两个相邻的格子,问给定一个矩形,放一个东西的方案数。 思路:q很大。。应该是先预处理出来直接调用答案。。。计数问题累加性。。应该是前缀和之类。。需要做的就是怎么标记。。我的做法是竖着放和横着放的个数分开来存。从左往右从上往下,每次标记到后一个点。然后二维的前缀和。然后每次询问的时候,去掉最上边和最左边两条边界上对应的多加的点。
http://codeforces.com/problemset/problem/31/C 题意:给出n个借用教室的时间安排,可能会有冲突。要求恰好去掉一个时间安排使得剩下的时间安排不冲突。问多多少种方案。 思路:首先一个直觉是。。除非初始就没有任何冲突。。不然这个答案不会很大。。
http://codeforces.com/problemset/problem/1/B 题意:给出了两种表格的表示方法。要求互相转化。 思路:直接模拟即可。注意和一般的进制转化不同的是,26进制对应的是1到26而不是0到25,所以要记得处理下借位。
http://codeforces.com/problemset/problem/158/B 题意:n组人,每组有si个(1<=si<=4),每辆车能装4个人。问最少需要多少辆车装下所有人并且保证同一组的人在一辆车里。 思路:统计人数分别为1,2,3,4的人数。对于4的直接加到答案。贪心的思路是:优先用人数少的去填人数多的。
模拟.
直接搞…
并不明白坑在哪里...
排在我前面被hack了100多人…
B. Order Book
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
In this task you need to process a set of stock exchange orders and use them to create order book.
傻逼模拟题
我做了半小时….
sssssad
1/************************************************************************* 2 > File Name: code/bc/#52/1001.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年08月22日 星期六 18时51分44秒 6 ************************************************************************/ 7#include<iostream> 8#include<iomanip> 9#include<cstdio> 10#include<algorithm> 11#include<cmath> 12#include<cstring> 13#include<string> 14#include<map> 15#include<set> 16#include<queue> 17#include<vector> 18#include<stack> 19#include<cctype> 20#define y1 hust111qqz 21#define yn hez111qqz 22#define j1 cute111qqz 23#define ms(a,x) memset(a,x,sizeof(a)) 24#define lr dying111qqz 25using namespace std; 26#define For(i, n) for (int i=0;i<int(n);++i) 27typedef long long LL; 28typedef double DB; 29const int inf = 0x3f3f3f3f; 30const int N=1E6+7; 31int main() 32{ 33 #ifndef ONLINE_JUDGE 34 freopen("in.txt","r",stdin); 35 #endif 36 int x,y,w,n; 37 while (scanf("%d%d%d%d",&x,&y,&w,&n)!=EOF){ 38 int num = 1; 39 int cnt; 40 int q; 41 bool on = true; 42 bool flag = false; 43 int t = 0; 44 while (t<N&&!flag){ 45 if (num==n) { 46 cout<<t<<endl; 47 flag = true; 48 break; 49 } 50 cnt = t+x; 51 q = 0; 52 while (t<cnt){ 53 q++; 54 t++; 55 if (q%w==0){ 56// cout<<"aaat:"<<t<<endl; 57 num++; 58 } 59 if (num == n){ 60 cout<<t<<endl; 61 flag = true; 62 break; 63 } 64 } 65 on = false; 66 t = t + y; 67 on = true; 68 num++; 69 if (num==n){ 70 cout<<t<<endl; 71 flag = true; 72 } 73 } 74 } 75 #ifndef ONLINE_JUDGE 76 fclose(stdin); 77 #endif 78 return 0; 79}
1/************************************************************************* 2 > File Name: code/cf/#313/B.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: Wed 22 Jul 2015 09:52:54 PM CST 6 ************************************************************************/ 7 8#include<iostream> 9#include<iomanip> 10#include<cstdio> 11#include<algorithm> 12#include<cmath> 13#include<cstring> 14#include<string> 15#include<map> 16#include<set> 17#include<queue> 18#include<vector> 19#include<stack> 20#define y0 abc111qqz 21#define y1 hust111qqz 22#define yn hez111qqz 23#define j1 cute111qqz 24#define tm crazy111qqz 25#define lr dying111qqz 26using namespace std; 27#define REP(i, n) for (int i=0;i<int(n);++i) 28typedef long long LL; 29typedef unsigned long long ULL; 30 31 int a1,b1,a2,b2,a3,b3; 32bool judge (int x2,int y2,int x3,int y3) 33{ 34 if (x2<=a1&&x3<=a1&&y2+y3<=b1) 35 return true; 36 if (y2<=b1&&y3<=b1&&x2+x3<=a1) 37 return true; 38 return false; 39} 40int main() 41{ 42 cin>>a1>>b1>>a2>>b2>>a3>>b3; 43 if (judge(a2,b2,a3,b3)||judge(b2,a2,a3,b3)||judge(b2,a2,b3,a3)||judge(a2,b2,b3,a3)) 44 { 45 puts("YES"); 46 } 47 else 48 { 49 puts("NO"); 50 } 51 52 return 0; 53}
比赛的时候没搞出来,really sad. 其实这题很容易啊.... 首先,对于lie 的判断应该基于能放的船的个数. 能放的船的个数是随着射的点数的增加而减少的. 射完每个点后更新能放的船的个数,如果这个时候已经无法放下k条船了,说明lie了. 如果所有都射完也没发生,那么就-1.