-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday_ten.cpp
132 lines (93 loc) · 2.15 KB
/
day_ten.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
Name -- Himnashu Pokhriyal
Date -- 4 April , 2024
Version -- 5.4
Question --1 Rain in Chefland {Difficulty - 328}
Link -- https://www.codechef.com/practice/course/basic-programming-concepts/DIFF500/problems/RAINFALL1
Approach & Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t,x;
cin>>t;
while(t--){
cin>>x;
if(x<3){
cout<<"LIGHT"<<endl;
}
else if(x>=3 && x<7){
cout<<"MODERATE"<<endl;
}
else{
cout<<"HEAVY"<<endl;
}
}
}
Time Complexity --> O(T)
Space Complexity --> O(1)
Question -- 2 Bidding { Difficulty - 330 }
Link -- https://www.codechef.com/practice/course/basic-programming-concepts/DIFF500/problems/AUCTION
Approach & Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t, a,b,c;
cin>>t;
while(t--){
cin>>a>>b>>c;
if(a>b && a>c){
cout<<"Alice"<<endl;
}
else if(b>a && b>c){
cout<<"Bob"<<endl;
}
else{
cout<<"Charlie"<<endl;
}
}
}
Time Complexity --> O(T)
Space Complexity --> O(1)
Question -- 3 Overspeeding Fine { Difficulty - 335 }
Link -- https://www.codechef.com/practice/course/basic-programming-concepts/DIFF500/problems/FINE
Approach & Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t, x;
cin>>t;
while(t--){
cin>>x;
if(x<=70){
cout<<"0"<<endl;
}
else if( x>70 && x<=100){
cout<<"500"<<endl;
}
else{
cout<<"2000"<<endl;
}
}
}
Time Complexity --> O(T)
Space Complexity --> O(1)
Question -- 4 Chess Time
link -- https://www.codechef.com/practice/course/basic-programming-concepts/DIFF500/problems/CHESSTIME
Approach & Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t , n;
cin>>t;
while( t-- ){
cin>>n;
cout<<(3*n)<<endl;
}
}
Time Complexity --> O(T)
Space Complexity --> O(1)
*/