-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraft.cpp
67 lines (61 loc) · 1.29 KB
/
draft.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// #include<stdio.h>
//
// void fun(char* t, char* s) {
// while (*t != '\0')
// t++;
// while ((*t++=*s++) != '\0');
// }
//
// int main() {
// char s1[10] = "123", s2[10] = "9978";
// fun(s1, s2);
// printf(s1);
// return 0;
// }
#include<string>
#include<vector>
#include<iostream>
#include<cmath>
using namespace std;
class Solution {};
int numSee(const vector<int>& soldierArray, int numSoldier) {
if (numSoldier == 0) return 0;
int curMax = soldierArray[0];
int cnt = 1;
for (int i=1; i<numSoldier; ++i) {
if (soldierArray[i] > curMax) {
curMax = soldierArray[i];
++cnt;
}
}
return cnt;
}
void f(double n) {
cout << "==>" << n << endl;
}
// entrance
int main(){
/*
int numCols;
vector<int> soldierArray;
vector<int> res;
cout << "input numCols: \n";
cin >> numCols;
for (int i=0; i!=numCols; ++i) {
int tmp = 0;
int numSoldier = 0;
cout << "input numSoldier: \n";
cin >> numSoldier;
while (cin >> tmp) {
soldierArray.push_back(tmp);
}
res.push_back(numSee(soldierArray, numSoldier));
}
for (auto &c : res) {
cout << c << endl;
}
*/
double a = pow(2, 3);
f(a);
return 0;
}