Repository navigation
Expand file tree
/
Copy pathcodes.js
More file actions
91 lines (76 loc) · 1.76 KB
/
Copy pathcodes.js
File metadata and controls
91 lines (76 loc) · 1.76 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module.exports = {
answers: [`#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
float pl = 0, mn = 0, zr = 0;
for (int i = 0; i < n; i++) {
int val;
cin >> val;
zr += (val == 0);
pl += (val > 0);
mn += (val < 0);
}
zr = zr / (double)n;
pl = pl / (double)n;
mn = mn / (double)n;
printf("%0.06lf\n%0.06lf\n%0.06lf\n", pl, mn, zr);
return 0;
}`,`#include<iostream>
using namespace std;
int main () {
int height;
cin >> height;
for (int i = 1; i <= height; i++) {
for (int j = 0; j < i; j++) {
if(j==0) {
//Printing spaces
for(int t = 0; t < height - i; t++) cout << " ";
}
//Print hashes
cout << "#";
}
cout << endl;
}
return 0;
}`,`#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
int main(){
LL s[5];
LL d = 0;
for(int i = 0; i < 5; i++){
cin >> s[i];
d += s[i];
}
sort(s,s+5);
cout << d-s[4] << " " << d-s[0] << endl;
`,`#include <iostream>
int main(){
int c, n, max = 0;
std::cin.ignore();
while(std::cin >> n)
max < n ? c = !!(max = n) : c += max == n;
std::cout << c;
return 0;
}`,`#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <iomanip>
using namespace std;
int main(){
int h, m, s;
char ch, aorp;
cin >> h >> ch >> m >> ch >> s >> aorp >> ch;
h = (aorp == 'A') ? (h==12 ? 0 : h) : (h==12 ? 12 : h+12);
cout << setw(2) << setfill('0') << h << ":"
<< setw(2) << setfill('0') << m << ":"
<< setw(2) << setfill('0') << s << endl;
return 0;
}`
]
}