-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhome.html
325 lines (295 loc) · 9.62 KB
/
home.html
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html>
<html>
<head>
<title>Codeforces to Codechef rating converter</title>
<style>
body {
background-color: #1e1e1e;
font-family: 'Courier New', Courier, monospace;
color: #ffffff;
text-align: center;
margin: 0;
padding: 0;
}
h1 {
margin-top: 70px;
}
.navbar {
background-color: #333333;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
}
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.navbar ul li {
display: inline-block;
margin-right: 10px;
}
.navbar ul li a {
color: #ffffff;
text-decoration: none;
padding: 10px;
}
.navbar ul li a:hover {
background-color: #ff6600;
}
form {
margin-top: 50px;
}
.input-group {
margin-bottom: 20px;
}
.input-group label {
display: block;
font-size: 20px;
margin-bottom: 5px;
}
.input-group input {
padding: 10px;
font-size: 18px;
border-radius: 5px;
border: none;
width: 250px;
background-color: #2e2e2e;
color: #ffffff;
}
.submit-btn {
margin-top: 10px;
padding: 10px 20px;
font-size: 18px;
border-radius: 5px;
border: none;
background-color: #ff6600;
color: #ffffff;
cursor: pointer;
}
.submit-btn:hover {
background-color: #ff8533;
}
</style>
</head>
<body>
<div class="navbar">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="status.html">Status</a></li>
<li><a href="codeclock.html">Codeclock</a></li>
</ul>
</div>
<h1>Codeforces to Codechef rating converter</h1>
<form onsubmit="predictCF()">
<div class="input-group">
<label for="input0">Codeforces Rating:</label>
<input type="number" min="0" id="input0" placeholder="Codeforces Max Rating" required oninput="checkMinValue(this)">
<label for="input1"></label>
<input type="number" min="0" id="input1" placeholder="Last Codeforces Rating" required oninput="checkMinValue(this)">
<label for="input2"></label>
<input type="number" min="0" id="input2" placeholder="Second Last Codeforces Rating" required oninput="checkMinValue(this)">
<label for="input3"></label>
<input type="number" min="0" id="input3" placeholder="Third Last Codeforces Rating" required oninput="checkMinValue(this)">
<label for="input4"></label>
<input type="number" min="0" id="input4" placeholder="Fourth Last Codeforces Rating" required oninput="checkMinValue(this)">
<label for="input5"></label>
<input type="number" min="0" id="input5" placeholder="Fifth Last Codeforces Rating" required oninput="checkMinValue(this)">
<br><button type="button" onclick="predictCF()" class="submit-btn">Convert</button>
</div>
<div class="input-group">
<label for="output1">Predicted Codechef Rating:</label>
<input type="number" min="0" id="output1" placeholder="Converted Codechef rating" pattern="^(?!-)[0-9]+$" title="Please enter only positive integer values" readonly>
</div>
<!-- <button type="submit" class="submit-btn">Convert</button> -->
</form>
<script>
async function predictCF() {
// Scaling Parameters for the input values
const meanCF=[
1825.4548387096775,
1746.483870967742,
1724.2967741935483,
1706.7290322580645,
1687.8451612903225,
1673.1129032258063,
3320132.9870967744,
3240073.1806451613,
3176540.212903226,
3130736.206451613,
3096066.0935483873,
6850075030.780645,
6621022125.341935,
6433519863.67742,
6358146350.793549,
6273432344.7709675
];
const stdCF=[
543.2954963330126,
520.385074682782,
517.4335555948994,
514.2658362044735,
531.8150655756895,
545.6369605454041,
2059428.3109835437,
2037699.2440900842,
2006880.7417028772,
2065441.2197304103,
2061161.943143167,
6700464578.839158,
6604386290.136724,
6451091061.063176,
6696797797.619845,
6607289433.721786
];
const weightCF=[
274.22418375460137,
-205.5520544698708,
-45.58081432031249,
-62.044452546476826,
177.53208142169393,
-211.88277700228528,
353.8130129282163,
261.3225120036117,
464.60006971036586,
-717.2342251541672,
467.7974294325564,
-121.17488309021998,
-222.8771810004437,
-390.53114724576795,
474.5415221581281,
-174.86475939264045
]
var r0=parseInt(document.getElementById('input0').value);
var r1=parseInt(document.getElementById('input1').value);
var r2=parseInt(document.getElementById('input2').value);
var r3=parseInt(document.getElementById('input3').value);
var r4=parseInt(document.getElementById('input4').value);
var r5=parseInt(document.getElementById('input5').value);
var rawInput=[
r0, r1, r2, r3, r4, r5, r1**2, r2**2, r3**2, r4**2, r5**2, r1**3, r2**3, r3**3, r4**3, r5**3
]
for (let index = 0; index < rawInput.length; index++) {
const element = rawInput[index];
rawInput[index]=(element-meanCF[index])/stdCF[index];
}
var result=2046.8668984593405;
for (let index = 0; index < rawInput.length; index++) {
const element = rawInput[index];
result+=(element*weightCF[index]);
}
result=parseInt(result);
if (result<0) {
result=0;
}
document.getElementById('output1').value=result;
}
</script>
<h1>Codechef to Codeforces rating converter</h1>
<form onsubmit="predictCC()">
<div class="input-group">
<label for="input6">Codechef Rating:</label>
<input type="number" min="0" id="input6" placeholder="Last Codechef Rating" required oninput="checkMinValue(this)">
<label for="input7"></label>
<input type="number" min="0" id="input7" placeholder="Second Codechef Rating" required oninput="checkMinValue(this)">
<label for="input8"></label>
<input type="number" min="0" id="input8" placeholder="Third Last Codechef Rating" required oninput="checkMinValue(this)">
<label for="input9"></label>
<input type="number" min="0" id="input9" placeholder="Fourth Last Codechef Rating" required oninput="checkMinValue(this)">
<label for="input10"></label>
<input type="number" min="0" id="input10" placeholder="Fifth Last Codechef Rating" required oninput="checkMinValue(this)">
<br><button type="button" onclick="predictCC()" class="submit-btn">Convert</button>
</div>
<div class="input-group">
<label for="output2">Predicted Codeforces Rating:</label>
<input type="number" min="0" id="output2" placeholder="Converted Codechef rating" pattern="^(?!-)[0-9]+$" title="Please enter only positive integer values" readonly>
</div>
<!-- <button type="submit" class="submit-btn">Convert</button> -->
</form>
<script>
async function predictCC() {
// Scaling Parameters for the input values
const meanCC=[
2040.2967741935483,
2022.5354838709677,
2002.5645161290322,
1977.5451612903225,
1945.9548387096775,
4287906.561290323,
4211760.774193549,
4130190.5129032256,
4031035.5387096773,
3906888.316129032,
9303994848.258064,
9052092762.167742,
8796134589.5,
8492589222.4096775,
8121004116.03871
];
const stdCC=[
354.26046173238416,
348.5727121133036,
346.86305836899373,
347.476845484749,
347.1842602642243,
1581257.6328210311,
1544767.7466918447,
1527973.762595602,
1514415.4910875948,
1508219.209160731,
5479764000.607299,
5324768022.7590475,
5240903843.745591,
5155650575.455764,
5126267875.614567
];
const weightCC=[
335.39751922,
612.22257486,
448.08786453,
-452.07478843,
102.64775822,
-166.78081542,
-226.10882384,
-361.88745037,
-324.58029713,
69.44098447,
135.00646266,
-111.97764234,
-227.47051578,
993.26718112,
-357.57414443
];
var v1=parseInt(document.getElementById('input6').value);
var v2=parseInt(document.getElementById('input7').value);
var v3=parseInt(document.getElementById('input8').value);
var v4=parseInt(document.getElementById('input9').value);
var v5=parseInt(document.getElementById('input10').value);
var rawInputCC=[
v1, v2, v3, v4, v5, v1**2, v2**2, v3**2, v4**2, v5**2, v1**3, v2**3, v3**3, v4**3, v5**3
];
for (let index = 0; index < rawInputCC.length; index++) {
const element = rawInputCC[index];
rawInputCC[index]=(element-meanCC[index])/stdCC[index];
};
let result=1753.5943508554315;
for (let index = 0; index < rawInputCC.length; index++) {
const element = rawInputCC[index];
result+=(element*weightCC[index]);
}
result=parseInt(result);
if (result<0) {
result=0;
}
document.getElementById('output2').value=result;
}
function checkMinValue(input) {
if (input.value < 0) {
input.value = 0; // Reset to 0 if value is less than 0
}
}
</script>
</body>
</html>