Last active
October 19, 2020 08:12
-
-
Save chaidhat/f585e00c2a853de48ac91891c1c5e2fb to your computer and use it in GitHub Desktop.
Kick Start round G 18/10/2020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18-OCT-2020 | |
Chaidhat Chaimongkol | |
Partial Attempt - Place didn't count (Joined at 1.5 hours remaining) | |
6329/8100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fixed POST GAME. NOT COUNTED IN COMPETITION | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main () | |
{ | |
int T; cin >> T; | |
for (int i = 0; i < T; i++) | |
{ | |
string str; cin >> str; //INPUT GOES INTO STRING | |
int j = 0; | |
int timesKickAppears = 0; | |
int frags = 0; | |
while(j+4 < str.length()) | |
{ | |
if (str.at(j) == 'K' && str.at(j+1) == 'I' && str.at(j+2) == 'C' && str.at(j+3) == 'K') | |
{ | |
timesKickAppears++; | |
//cout << "KI" << j << "\n"; | |
} | |
if (str.at(j) == 'S' && str.at(j+1) == 'T' && str.at(j+2) == 'A' && str.at(j+3) == 'R' && str.at(j+4) == 'T') | |
{ | |
frags += timesKickAppears; | |
//cout << "ST" << j << "\n"; | |
} | |
j++; | |
} | |
cout << "Case #" << (i+1) << ": " << frags << "\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WRONG ANSWER | |
#include<iostream> | |
#include <sstream> | |
using namespace std; | |
int main () | |
{ | |
int T; | |
cin >> T; | |
char str[100001]; | |
for (int i = 0; i < T; i++) | |
{ | |
cin >> str; //INPUT GOES INTO STRING | |
int j = 0; | |
int timesKickAppears = 0; | |
int timesStartAppears = 0; | |
int frags = 0; | |
while(str[j+4] != '\0') | |
{ | |
if (str[j] == 'K' && str[j+1] == 'I' && str[j+2] == 'C' && str[j+3] == 'K') | |
{ | |
timesKickAppears++; | |
//cout << "KI" << j << "\n"; | |
} | |
if (str[j] == 'S' && str[j+1] == 'T' && str[j+2] == 'A' && str[j+3] == 'R' && str[j+4] == 'T') | |
{ | |
frags += timesKickAppears; | |
//cout << "ST" << j << "\n"; | |
} | |
j++; | |
} | |
cout << "Case #" << (i+1) << ": " << frags << "\n"; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CORRECT CORRECT | |
T = int(input()) | |
for i in range(T): | |
Ss = input() | |
S = Ss.split() | |
frags = 0 | |
tka = 0 | |
for sn in range(len(Ss)): | |
if sn < len(Ss) - 4: | |
if Ss[sn] == "K" and Ss[sn+1] == "I" and Ss[sn+2] == "C" and Ss[sn+3] == "K": | |
tka = tka+1 | |
if Ss[sn] == "S" and Ss[sn+1] == "T" and Ss[sn+2] == "A" and Ss[sn+3] == "R" and Ss[sn+4] == "T": | |
frags = frags + tka | |
print("case #" + str(i + 1) + ": " + str(frags)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Chaidhat Chaimongkol | |
#include <bits/stdc++.h> | |
using namespace std; | |
void Solve () | |
{ | |
// str.length() is string's length | |
// str.at(i) where int i is the character at that index | |
long long ans = 0; | |
int N; cin >> N; | |
long cells[N+1][N+1]; | |
for(int i = 1; i <= N; i++) | |
{ | |
for (int j = 1; j <= N; j++) | |
{ | |
int c; cin >> c; | |
cells[i][j] = c; | |
} | |
} | |
for (int x = 1; x <= N; x++) | |
{ | |
int y = 1; | |
long long total = 0; | |
for (int i = x; i <= N; i++) | |
{ | |
total += cells[i][y]; | |
y++; | |
} | |
ans = max(ans, total); | |
} | |
for (int y = 1; y <= N; y++) | |
{ | |
int x = 1; | |
long long total = 0; | |
for (int i = y; i <= N; i++) | |
{ | |
total += cells[x][i]; | |
x++; | |
} | |
ans = max(ans, total); | |
} | |
// CODE CODE CODE | |
cout << ans; // NO ENDLINE NEEDED | |
} | |
int main () | |
{ | |
int T; cin >> T; | |
for (int i = 0; i < T; i++) | |
{ | |
cout << "Case #" << (i+1) << ": "; | |
Solve(); | |
cout << "\n"; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOT FINISHED | |
T = int(input()) | |
for i in range(T): | |
N = int(input()) | |
COM = [] | |
for n in range(N): | |
COM[n] = [] | |
Ss = input() | |
S = Ss.split() | |
A = 1 | |
for Sss in S: | |
COM[n][A] = Sss | |
A = A + 1 | |
print(COM) | |
print("case #" + str(i + 1) + ": " + str(frags)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment