跳过正文
  1. Posts/

bc #52 div 2 A ||hdoj5417 Victor and Machine (模拟)

·1 分钟

傻逼模拟题

我做了半小时….

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}

相关文章

codeforces 560 B. Gerald is into Art (模拟)

·1 分钟
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}

codeforces 314 D One-Dimensional Battle Ships (模拟)

·2 分钟
比赛的时候没搞出来,really sad. 其实这题很容易啊.... 首先,对于lie 的判断应该基于能放的船的个数. 能放的船的个数是随着射的点数的增加而减少的. 射完每个点后更新能放的船的个数,如果这个时候已经无法放下k条船了,说明lie了. 如果所有都射完也没发生,那么就-1.

hdu 1050 Moving Tables

·1 分钟
一开始算法想的有点问题。 坑点在于走廊两侧都有房间 也就是说room1和room2对应的位置是一样的