bc #52 div 2 A ||hdoj5417 Victor and Machine (模拟)
傻逼模拟题
我做了半小时....
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}