# 2015632, 2024-09-28 10:26:17, PPPPP-----P--------- (30%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string card;
int resulta = 0;
int resultb = 0;
int cardnum;
for(int i = 0; i < a;i++){
cin >> card;
if(card == "A"){
resulta += 1;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resulta += 10;
}else {
cardnum = stoi(card);
resulta += cardnum;
}
}
// cout << resulta << " ";
for(int i = 0; i < b;i++){
cin >> card;
if(card == "A"){
resultb += 1;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resultb += 10;
}else {
cardnum = stoi(card);
resultb += cardnum;
}
}
if(resulta > resultb){
cout << "A" << endl;
} else if (resultb > resulta){
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << resulta << " " << resultb;
} | # 2015793, 2024-09-28 10:43:56, PPPP-PP---PP-------- (40%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string card;
int resulta = 0;
int resultb = 0;
int cardnum;
for(int i = 0; i < a;i++){
cin >> card;
if(card == "A"){
resulta += 1;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resulta += 10;
}else {
cardnum = stoi(card);
resulta += cardnum;
}
}
// cout << resulta << " ";
for(int i = 0; i < b;i++){
cin >> card;
if(card == "A"){
resultb += 1;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resultb += 10;
}else {
cardnum = stoi(card);
resultb += cardnum;
}
}
if((resulta > resultb && resulta < 22) || resultb > 22) {
cout << "A" << endl;
} else if ((resultb > resulta && resultb < 22) || resulta > 22){
cout << "B" << endl;
} else if (resulta == resultb|| (resultb > 22 && resulta > 22)){
cout << "Draw" << endl;
}
cout << resulta << " " << resultb;
} | # 2016032, 2024-09-28 11:06:02, -PPPPPPP-PPPPPPPPPPP (90%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string card;
int resulta = 0;
int resultb = 0;
int cardnum;
for(int i = 0; i < a;i++){
cin >> card;
if(card == "A"){
resulta += 1;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resulta += 10;
}else {
cardnum = stoi(card);
resulta += cardnum;
}
}
if(21 - resulta >= 10){
resulta+= 10;
}
// cout << resulta << " ";
for(int i = 0; i < b;i++){
cin >> card;
if(card == "A"){
resultb += 1;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resultb += 10;
}else {
cardnum = stoi(card);
resultb += cardnum;
}
}
if(21 - resultb >= 10){
resultb+= 10;
}
if((resulta == resultb)|| (resultb > 21 && resulta > 21)) {
cout << "Draw" << endl;
} else if ((resultb > resulta && resultb < 22) || resulta > 21){
cout << "B" << endl;
} else if ((resulta > resultb && resulta < 22) || resultb > 21){
cout << "A" << endl;
}
cout << resulta << " " << resultb;
} | # 2016093, 2024-09-28 11:12:45, PPPPPPPP-PPPPPPPPPPP (95%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string card;
int resulta = 0;
int resultb = 0;
int cardnum;
bool check = false;
for(int i = 0; i < a;i++){
cin >> card;
if(card == "A"){
resulta += 1;
check = true;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resulta += 10;
}else {
cardnum = stoi(card);
resulta += cardnum;
}
}
if(check){
if(21 - resulta >= 10){
resulta+= 10;
}
}
// cout << resulta << " ";
for(int i = 0; i < b;i++){
cin >> card;
if(card == "A"){
resultb += 1;
check = true;
}
else if(card == "J"|| card == "Q" || card == "K"|| card == "10"){
resultb += 10;
}else {
cardnum = stoi(card);
resultb += cardnum;
}
}
if(check){
if(21 - resultb >= 10){
resultb+= 10;
}
}
if((resulta == resultb)|| (resultb > 21 && resulta > 21)) {
cout << "Draw" << endl;
} else if ((resultb > resulta && resultb < 22) || resulta > 21){
cout << "B" << endl;
} else if ((resulta > resultb && resulta < 22) || resultb > 21){
cout << "A" << endl;
}
cout << resulta << " " << resultb;
} |
# 2017305, 2024-09-28 13:16:36, PPPPP---PPP---P-P-P- (55%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb){
cout << 'A' << '\n';
}
else if(sumb > suma){
cout << 'B' << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2017337, 2024-09-28 13:19:32, PPPPP--PPPP---P-P-P- (60%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2017364, 2024-09-28 13:22:46, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2017370, 2024-09-28 13:23:56, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && sumb > 21){
cout << "Draw" << '\n';
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2017376, 2024-09-28 13:24:33, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018586, 2024-09-28 15:10:48, PPPPPPPPPPPPP-P-PPP- (85%)
// #include<bits/stdc++.h>
// using namespace std;
// int main(){
// int a = 0, b = 0, suma = 0, sumb = 0;
// cin >> a >> b;
// string A[100];
// string B[100];
// int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
// string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
// for(int i = 0; i < a; i++){
// cin >> A[i];
// }
// for(int j = 0; j < b; j++){
// cin >> B[j];
// }
// //a
// for(int i = 0; i < a; i++){
// for(int j = 0; j < 12; j++)
// if(A[i] == s[j]){
// suma += c[j];
// }
// }
// for(int i = 0; i < a; i++){
// if(A[i] == "A"){
// if(suma <= 10){
// suma += 11;
// }
// else{
// suma += 1;
// }
// }
// }
// //b
// for(int i = 0; i < b; i++){
// for(int j = 0; j < 12; j++)
// if(B[i] == s[j]){
// sumb += c[j];
// }
// }
// for(int i = 0; i < b; i++){
// if(B[i] == "A"){
// if(sumb <= 10){
// sumb += 11;
// }
// else{
// sumb += 1;
// }
// }
// }
// if(suma > sumb && suma <= 21){
// cout << 'A' << '\n';
// }
// else if(sumb > suma && sumb <= 21){
// cout << 'B' << '\n';
// }
// else if(suma > 21 && sumb <= 21){
// cout << 'B' << '\n';
// }
// else if(sumb > 21 && suma <= 21){
// cout << 'A' << '\n';
// }
// else if(sumb > 21 && suma > 21){
// cout << "Draw" << '\n';
// }
// else{
// cout << "Draw" <<'\n';
// }
// cout << suma << ' ' << sumb;
// }
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018594, 2024-09-28 15:11:15, PPPPPPPPPPPPP-P-PP-- (80%)
// #include<bits/stdc++.h>
// using namespace std;
// int main(){
// int a = 0, b = 0, suma = 0, sumb = 0;
// cin >> a >> b;
// string A[100];
// string B[100];
// int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
// string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
// for(int i = 0; i < a; i++){
// cin >> A[i];
// }
// for(int j = 0; j < b; j++){
// cin >> B[j];
// }
// //a
// for(int i = 0; i < a; i++){
// for(int j = 0; j < 12; j++)
// if(A[i] == s[j]){
// suma += c[j];
// }
// }
// for(int i = 0; i < a; i++){
// if(A[i] == "A"){
// if(suma <= 10){
// suma += 11;
// }
// else{
// suma += 1;
// }
// }
// }
// //b
// for(int i = 0; i < b; i++){
// for(int j = 0; j < 12; j++)
// if(B[i] == s[j]){
// sumb += c[j];
// }
// }
// for(int i = 0; i < b; i++){
// if(B[i] == "A"){
// if(sumb <= 10){
// sumb += 11;
// }
// else{
// sumb += 1;
// }
// }
// }
// if(suma > sumb && suma <= 21){
// cout << 'A' << '\n';
// }
// else if(sumb > suma && sumb <= 21){
// cout << 'B' << '\n';
// }
// else if(suma > 21 && sumb <= 21){
// cout << 'B' << '\n';
// }
// else if(sumb > 21 && suma <= 21){
// cout << 'A' << '\n';
// }
// else if(sumb > 21 && suma > 21){
// cout << "Draw" << '\n';
// }
// else{
// cout << "Draw" <<'\n';
// }
// cout << suma << ' ' << sumb;
// }
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
if(B[i] == "A" && B[b-1] == "A"){
sumb += 2;
sumb -= 1;
}
else{
sumb += 11;
}
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018693, 2024-09-28 15:15:51, -------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A" && B[b-1] != "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
else{
sumb += 2;
break;
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018709, 2024-09-28 15:16:31, -------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A" && B[b-1] != "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
else{
sumb += 2;
break;
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018724, 2024-09-28 15:16:56, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018775, 2024-09-28 15:18:24, -------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A" && B[b-1] != "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
else{
sumb += 2;
break;
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} | # 2018805, 2024-09-28 15:19:11, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 0, b = 0, suma = 0, sumb = 0;
cin >> a >> b;
string A[100];
string B[100];
int c[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
string s[12] = {"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i = 0; i < a; i++){
cin >> A[i];
}
for(int j = 0; j < b; j++){
cin >> B[j];
}
//a
for(int i = 0; i < a; i++){
for(int j = 0; j < 12; j++)
if(A[i] == s[j]){
suma += c[j];
}
}
for(int i = 0; i < a; i++){
if(A[i] == "A"){
if(suma <= 10){
suma += 11;
}
else{
suma += 1;
}
}
}
//b
for(int i = 0; i < b; i++){
for(int j = 0; j < 12; j++)
if(B[i] == s[j]){
sumb += c[j];
}
}
for(int i = 0; i < b; i++){
if(B[i] == "A"){
if(sumb <= 10){
sumb += 11;
}
else{
sumb += 1;
}
}
}
if(suma > sumb && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > suma && sumb <= 21){
cout << 'B' << '\n';
}
else if(suma > 21 && sumb <= 21){
cout << 'B' << '\n';
}
else if(sumb > 21 && suma <= 21){
cout << 'A' << '\n';
}
else if(sumb > 21 && suma > 21){
cout << "Draw" << '\n';
}
else{
cout << "Draw" <<'\n';
}
cout << suma << ' ' << sumb;
} |
# 2015128, 2024-09-28 09:37:57, P-PPP-----P---P-P--- (35%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
char a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=='1'){
ans++;
}
else if(a=='2'){
ans+=2;
}
else if(a=='3'){
ans+=3;
}
else if(a=='4'){
ans+=4;
}
else if(a=='5'){
ans+=5;
}
else if(a=='6'){
ans+=6;
}
else if(a=='7'){
ans+=7;
}
else if(a=='8'){
ans+=8;
}
else if(a=='9'){
ans+=9;
}
else if(a=='J'){
ans+=10;
}
else if(a=='Q'){
ans+=10;
}
else if(a=='K'){
ans+=10;
}
else if(a=='A'){
check1++;
}
}
while(check1--){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=='1'){
ans++;
}
else if(b=='2'){
ans1+=2;
}
else if(b=='3'){
ans1+=3;
}
else if(b=='4'){
ans1+=4;
}
else if(b=='5'){
ans1+=5;
}
else if(b=='6'){
ans1+=6;
}
else if(b=='7'){
ans1+=7;
}
else if(b=='8'){
ans1+=8;
}
else if(b=='9'){
ans1+=9;
}
else if(b=='J'){
ans1+=10;
}
else if(b=='Q'){
ans1+=10;
}
else if(b=='K'){
ans1+=10;
}
else if(b=='A'){
check2++;
}
}
while(check2--){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1){
cout << "A"<<endl;
}
else if(ans<ans1){
cout << "B"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015591, 2024-09-28 10:21:32, P-PPP-----P---P-P--- (35%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
char a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=='1'){
ans++;
}
else if(a=='2'){
ans+=2;
}
else if(a=='3'){
ans+=3;
}
else if(a=='4'){
ans+=4;
}
else if(a=='5'){
ans+=5;
}
else if(a=='6'){
ans+=6;
}
else if(a=='7'){
ans+=7;
}
else if(a=='8'){
ans+=8;
}
else if(a=='9'){
ans+=9;
}
else if(a=='J'){
ans+=10;
}
else if(a=='Q'){
ans+=10;
}
else if(a=='K'){
ans+=10;
}
else if(a=='A'){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=='1'){
ans++;
}
else if(b=='2'){
ans1+=2;
}
else if(b=='3'){
ans1+=3;
}
else if(b=='4'){
ans1+=4;
}
else if(b=='5'){
ans1+=5;
}
else if(b=='6'){
ans1+=6;
}
else if(b=='7'){
ans1+=7;
}
else if(b=='8'){
ans1+=8;
}
else if(b=='9'){
ans1+=9;
}
else if(b=='J'){
ans1+=10;
}
else if(b=='Q'){
ans1+=10;
}
else if(b=='K'){
ans1+=10;
}
else if(b=='A'){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1){
cout << "A"<<endl;
}
else if(ans<ans1){
cout << "B"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015624, 2024-09-28 10:25:33, P-PPP-----P---P-P--- (35%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
char a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=='1'){
ans++;
}
else if(a=='2'){
ans+=2;
}
else if(a=='3'){
ans+=3;
}
else if(a=='4'){
ans+=4;
}
else if(a=='5'){
ans+=5;
}
else if(a=='6'){
ans+=6;
}
else if(a=='7'){
ans+=7;
}
else if(a=='8'){
ans+=8;
}
else if(a=='9'){
ans+=9;
}
else if(a=='J'){
ans+=10;
}
else if(a=='Q'){
ans+=10;
}
else if(a=='K'){
ans+=10;
}
else if(a=='A'){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=='1'){
ans1++;
}
else if(b=='2'){
ans1+=2;
}
else if(b=='3'){
ans1+=3;
}
else if(b=='4'){
ans1+=4;
}
else if(b=='5'){
ans1+=5;
}
else if(b=='6'){
ans1+=6;
}
else if(b=='7'){
ans1+=7;
}
else if(b=='8'){
ans1+=8;
}
else if(b=='9'){
ans1+=9;
}
else if(b=='J'){
ans1+=10;
}
else if(b=='Q'){
ans1+=10;
}
else if(b=='K'){
ans1+=10;
}
else if(b=='A'){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1){
cout << "A"<<endl;
}
else if(ans<ans1){
cout << "B"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015649, 2024-09-28 10:27:59, P-PPP-----P---P-P--- (35%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
char a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=='1'){
ans++;
}
else if(a=='2'){
ans+=2;
}
else if(a=='3'){
ans+=3;
}
else if(a=='4'){
ans+=4;
}
else if(a=='5'){
ans+=5;
}
else if(a=='6'){
ans+=6;
}
else if(a=='7'){
ans+=7;
}
else if(a=='8'){
ans+=8;
}
else if(a=='9'){
ans+=9;
}
else if(a=='10'){
ans+=10;
}
else if(a=='J'){
ans+=10;
}
else if(a=='Q'){
ans+=10;
}
else if(a=='K'){
ans+=10;
}
else if(a=='A'){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=='1'){
ans1++;
}
else if(b=='2'){
ans1+=2;
}
else if(b=='3'){
ans1+=3;
}
else if(b=='4'){
ans1+=4;
}
else if(b=='5'){
ans1+=5;
}
else if(b=='6'){
ans1+=6;
}
else if(b=='7'){
ans1+=7;
}
else if(b=='8'){
ans1+=8;
}
else if(b=='9'){
ans1+=9;
}
else if(b=='10'){
ans1+=10;
}
else if(b=='J'){
ans1+=10;
}
else if(b=='Q'){
ans1+=10;
}
else if(b=='K'){
ans1+=10;
}
else if(b=='A'){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1){
cout << "A"<<endl;
}
else if(ans<ans1){
cout << "B"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015727, 2024-09-28 10:35:36, PPPPP---PPP---P-P-P- (55%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
string a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=="1"){
ans++;
}
else if(a=="2"){
ans+=2;
}
else if(a=="3"){
ans+=3;
}
else if(a=="4"){
ans+=4;
}
else if(a=="5"){
ans+=5;
}
else if(a=="6"){
ans+=6;
}
else if(a=="7"){
ans+=7;
}
else if(a=="8"){
ans+=8;
}
else if(a=="9"){
ans+=9;
}
else if(a == "10"){
ans+=10;
}
else if(a=="J"){
ans+=10;
}
else if(a=="Q"){
ans+=10;
}
else if(a=="K"){
ans+=10;
}
else if(a=="A"){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=="1"){
ans1++;
}
else if(b=="2"){
ans1+=2;
}
else if(b=="3"){
ans1+=3;
}
else if(b=="4"){
ans1+=4;
}
else if(b=="5"){
ans1+=5;
}
else if(b=="6"){
ans1+=6;
}
else if(b=="7"){
ans1+=7;
}
else if(b=="8"){
ans1+=8;
}
else if(b=="9"){
ans1+=9;
}
else if(b == "10"){
ans1+=10;
}
else if(b=="J"){
ans1+=10;
}
else if(b=="Q"){
ans1+=10;
}
else if(b=="K"){
ans1+=10;
}
else if(b=="A"){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1){
cout << "A"<<endl;
}
else if(ans<ans1){
cout << "B"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015761, 2024-09-28 10:40:06, P-PPPPPP---PP-P-PP-- (60%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
string a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=="1"){
ans++;
}
else if(a=="2"){
ans+=2;
}
else if(a=="3"){
ans+=3;
}
else if(a=="4"){
ans+=4;
}
else if(a=="5"){
ans+=5;
}
else if(a=="6"){
ans+=6;
}
else if(a=="7"){
ans+=7;
}
else if(a=="8"){
ans+=8;
}
else if(a=="9"){
ans+=9;
}
else if(a == "10"){
ans+=10;
}
else if(a=="J"){
ans+=10;
}
else if(a=="Q"){
ans+=10;
}
else if(a=="K"){
ans+=10;
}
else if(a=="A"){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=="1"){
ans1++;
}
else if(b=="2"){
ans1+=2;
}
else if(b=="3"){
ans1+=3;
}
else if(b=="4"){
ans1+=4;
}
else if(b=="5"){
ans1+=5;
}
else if(b=="6"){
ans1+=6;
}
else if(b=="7"){
ans1+=7;
}
else if(b=="8"){
ans1+=8;
}
else if(b=="9"){
ans1+=9;
}
else if(b == "10"){
ans1+=10;
}
else if(b=="J"){
ans1+=10;
}
else if(b=="Q"){
ans1+=10;
}
else if(b=="K"){
ans1+=10;
}
else if(b=="A"){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1&&ans<21&&ans1<21){
cout << "A"<<endl;
}
else if(ans<ans1&&ans<21&&ans1<21){
cout << "B"<<endl;
}
else if(ans>ans1&&ans>21&&ans1<21){
cout << "B"<<endl;
}
else if(ans<ans1&&ans<21&&ans1>21){
cout << "A"<<endl;
}
else if(ans>21&&ans1>21){
cout << "Draw"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015833, 2024-09-28 10:47:34, PPPPP-PPP--PP-P-PPP- (70%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
string a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=="1"){
ans++;
}
else if(a=="2"){
ans+=2;
}
else if(a=="3"){
ans+=3;
}
else if(a=="4"){
ans+=4;
}
else if(a=="5"){
ans+=5;
}
else if(a=="6"){
ans+=6;
}
else if(a=="7"){
ans+=7;
}
else if(a=="8"){
ans+=8;
}
else if(a=="9"){
ans+=9;
}
else if(a == "10"){
ans+=10;
}
else if(a=="J"){
ans+=10;
}
else if(a=="Q"){
ans+=10;
}
else if(a=="K"){
ans+=10;
}
else if(a=="A"){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=="1"){
ans1++;
}
else if(b=="2"){
ans1+=2;
}
else if(b=="3"){
ans1+=3;
}
else if(b=="4"){
ans1+=4;
}
else if(b=="5"){
ans1+=5;
}
else if(b=="6"){
ans1+=6;
}
else if(b=="7"){
ans1+=7;
}
else if(b=="8"){
ans1+=8;
}
else if(b=="9"){
ans1+=9;
}
else if(b == "10"){
ans1+=10;
}
else if(b=="J"){
ans1+=10;
}
else if(b=="Q"){
ans1+=10;
}
else if(b=="K"){
ans1+=10;
}
else if(b=="A"){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1&&ans<=21&&ans1<=21){
cout << "A"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1<=21){
cout << "s";
cout << "B"<<endl;
}
else if(ans>ans1&&ans>21&&ans1<=21){
cout << "s";
cout << "B"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1>21){
cout << "A"<<endl;
}
else if(ans>21&&ans1>21){
cout << "Draw"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015838, 2024-09-28 10:48:16, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
string a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=="1"){
ans++;
}
else if(a=="2"){
ans+=2;
}
else if(a=="3"){
ans+=3;
}
else if(a=="4"){
ans+=4;
}
else if(a=="5"){
ans+=5;
}
else if(a=="6"){
ans+=6;
}
else if(a=="7"){
ans+=7;
}
else if(a=="8"){
ans+=8;
}
else if(a=="9"){
ans+=9;
}
else if(a == "10"){
ans+=10;
}
else if(a=="J"){
ans+=10;
}
else if(a=="Q"){
ans+=10;
}
else if(a=="K"){
ans+=10;
}
else if(a=="A"){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=="1"){
ans1++;
}
else if(b=="2"){
ans1+=2;
}
else if(b=="3"){
ans1+=3;
}
else if(b=="4"){
ans1+=4;
}
else if(b=="5"){
ans1+=5;
}
else if(b=="6"){
ans1+=6;
}
else if(b=="7"){
ans1+=7;
}
else if(b=="8"){
ans1+=8;
}
else if(b=="9"){
ans1+=9;
}
else if(b == "10"){
ans1+=10;
}
else if(b=="J"){
ans1+=10;
}
else if(b=="Q"){
ans1+=10;
}
else if(b=="K"){
ans1+=10;
}
else if(b=="A"){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1&&ans<=21&&ans1<=21){
cout << "A"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1<=21){
cout << "B"<<endl;
}
else if(ans>ans1&&ans>21&&ans1<=21){
cout << "B"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1>21){
cout << "A"<<endl;
}
else if(ans>21&&ans1>21){
cout << "Draw"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015864, 2024-09-28 10:51:45, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
string a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=="1"){
ans++;
}
else if(a=="2"){
ans+=2;
}
else if(a=="3"){
ans+=3;
}
else if(a=="4"){
ans+=4;
}
else if(a=="5"){
ans+=5;
}
else if(a=="6"){
ans+=6;
}
else if(a=="7"){
ans+=7;
}
else if(a=="8"){
ans+=8;
}
else if(a=="9"){
ans+=9;
}
else if(a == "10"){
ans+=10;
}
else if(a=="J"){
ans+=10;
}
else if(a=="Q"){
ans+=10;
}
else if(a=="K"){
ans+=10;
}
else if(a=="A"){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=="1"){
ans1++;
}
else if(b=="2"){
ans1+=2;
}
else if(b=="3"){
ans1+=3;
}
else if(b=="4"){
ans1+=4;
}
else if(b=="5"){
ans1+=5;
}
else if(b=="6"){
ans1+=6;
}
else if(b=="7"){
ans1+=7;
}
else if(b=="8"){
ans1+=8;
}
else if(b=="9"){
ans1+=9;
}
else if(b == "10"){
ans1+=10;
}
else if(b=="J"){
ans1+=10;
}
else if(b=="Q"){
ans1+=10;
}
else if(b=="K"){
ans1+=10;
}
else if(b=="A"){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1&&ans<=21&&ans1<=21){
cout << "A"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1<=21){
cout << "B"<<endl;
}
else if(ans>ans1&&ans>21&&ans1<=21){
cout << "B"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1>21){
cout << "A"<<endl;
}
else if(ans>21&&ans1>21){
cout << "Draw"<<endl;
}
else if(ans<21&&ans1<21&&ans==ans1){
cout << "Draw"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} | # 2015873, 2024-09-28 10:52:36, PPPPPPPPPPPPP-P-PPP- (85%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n1,n2,ans=0,ans1=0,check1=0,check2=0;
cin >> n1 >>n2;
string a,b;
for(int i=0; i<n1; i++)
{
cin >> a;
if(a=="1"){
ans++;
}
else if(a=="2"){
ans+=2;
}
else if(a=="3"){
ans+=3;
}
else if(a=="4"){
ans+=4;
}
else if(a=="5"){
ans+=5;
}
else if(a=="6"){
ans+=6;
}
else if(a=="7"){
ans+=7;
}
else if(a=="8"){
ans+=8;
}
else if(a=="9"){
ans+=9;
}
else if(a == "10"){
ans+=10;
}
else if(a=="J"){
ans+=10;
}
else if(a=="Q"){
ans+=10;
}
else if(a=="K"){
ans+=10;
}
else if(a=="A"){
check1++;
}
}
for(int i=0;i<check1;i++){
if(ans<=10){
ans+=11;
}
else if(ans>10){
ans++;
}
}
for(int i=0; i<n2; i++)
{
cin >> b;
if(b=="1"){
ans1++;
}
else if(b=="2"){
ans1+=2;
}
else if(b=="3"){
ans1+=3;
}
else if(b=="4"){
ans1+=4;
}
else if(b=="5"){
ans1+=5;
}
else if(b=="6"){
ans1+=6;
}
else if(b=="7"){
ans1+=7;
}
else if(b=="8"){
ans1+=8;
}
else if(b=="9"){
ans1+=9;
}
else if(b == "10"){
ans1+=10;
}
else if(b=="J"){
ans1+=10;
}
else if(b=="Q"){
ans1+=10;
}
else if(b=="K"){
ans1+=10;
}
else if(b=="A"){
check2++;
}
}
for(int i=0;i<check2;i++){
if(ans1<=10){
ans1+=11;
}
else if(ans1>10){
ans1++;
}
}
if(ans>ans1&&ans<=21&&ans1<=21){
cout << "A"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1<=21){
cout << "B"<<endl;
}
else if(ans>ans1&&ans>21&&ans1<=21){
cout << "B"<<endl;
}
else if(ans<ans1&&ans<=21&&ans1>21){
cout << "A"<<endl;
}
else if(ans>21&&ans1>21){
cout << "Draw"<<endl;
}
else if(ans<=21&&ans1<=21&&ans==ans1){
cout << "Draw"<<endl;
}
else{
cout << "Draw"<<endl;
}
cout << ans<< " "<<ans1;
} |
# 2017762, 2024-09-28 14:04:42, P-PPPPPP----P-P--P-- (50%)
#include<iostream>
using namespace std;
int main() {
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
if(A[k]=="A") {
if(21-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
if(B[k]=="A") {
if(21-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>21) && (sum_B<21)) {
cout << "B" << endl;
}
if((sum_A<21) && (sum_B>21)) {
cout << "A" << endl;
}
if((sum_A>21) && (sum_B>21)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<21) && (sum_B<21)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<21) && (sum_B<21)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<21) && (sum_B<21)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} | # 2017806, 2024-09-28 14:07:41, P-PPPPPP----P-P--P-- (50%)
#include<iostream>
#include<string>
using namespace std;
int main() {
int a,b;
cin >> a;
cin >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
if(A[k]=="A") {
if(21-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
if(B[k]=="A") {
if(21-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>21) && (sum_B<21)) {
cout << "B" << endl;
}
if((sum_A<21) && (sum_B>21)) {
cout << "A" << endl;
}
if((sum_A>21) && (sum_B>21)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<21) && (sum_B<21)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<21) && (sum_B<21)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<21) && (sum_B<21)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} | # 2017852, 2024-09-28 14:11:07, PPPPPPP-P----------- (40%)
#include<iostream>
#include<string>
using namespace std;
int main() {
int a,b;
cin >> a;
cin >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
if(A[k]=="A") {
if(22-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
if(B[k]=="A") {
if(22-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>22) && (sum_B<22)) {
cout << "B" << endl;
}
if((sum_A<22) && (sum_B>22)) {
cout << "A" << endl;
}
if((sum_A>22) && (sum_B>22)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<22) && (sum_B<22)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<22) && (sum_B<22)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<22) && (sum_B<22)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} | # 2017860, 2024-09-28 14:11:32, P-PPPPPP----P-P--P-- (50%)
#include<iostream>
#include<string>
using namespace std;
int main() {
int a,b;
cin >> a;
cin >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
if(A[k]=="A") {
if(21-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
if(B[k]=="A") {
if(21-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>21) && (sum_B<21)) {
cout << "B" << endl;
}
if((sum_A<21) && (sum_B>21)) {
cout << "A" << endl;
}
if((sum_A>21) && (sum_B>21)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<21) && (sum_B<21)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<21) && (sum_B<21)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<21) && (sum_B<21)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} | # 2017862, 2024-09-28 14:11:39, P-PPPPPP----P-P--P-- (50%)
#include<iostream>
#include<string>
using namespace std;
int main() {
int a,b;
cin >> a;
cin >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
if(A[k]=="A") {
if(21-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
if(B[k]=="A") {
if(21-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>21) && (sum_B<21)) {
cout << "B" << endl;
}
if((sum_A<21) && (sum_B>21)) {
cout << "A" << endl;
}
if((sum_A>21) && (sum_B>21)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<21) && (sum_B<21)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<21) && (sum_B<21)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<21) && (sum_B<21)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} | # 2017908, 2024-09-28 14:14:41, PPPPPPPPP---P-P--PP- (65%)
#include<iostream>
#include<string>
using namespace std;
int main() {
int a,b;
cin >> a;
cin >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
if(A[k]=="A") {
if(21-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
if(B[k]=="A") {
if(21-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>21) && (sum_B<21)) {
cout << "B" << endl;
}
if((sum_A<21) && (sum_B>21)) {
cout << "A" << endl;
}
if((sum_A>21) && (sum_B>21)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<22) && (sum_B<22)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<22) && (sum_B<22)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<22) && (sum_B<22)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} | # 2017957, 2024-09-28 14:20:28, PPPPPPPPPPPPP-P-PPP- (85%)
#include<iostream>
#include<string>
using namespace std;
int main() {
int a,b;
cin >> a;
cin >> b;
string A[a];
string B[b];
for(int i=0; i<a ; i++) {
cin >> A[i];
}
for(int j=0; j<b ; j++) {
cin >> B[j];
}
string pocker[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pocker_A[1]={"A"};
int score_A[2]={1,11};
int sum_A=0;
for(int k=0 ; k<a ; k++) {
for(int m=0 ; m<13 ; m++) {
if(A[k]==pocker[m]) {
sum_A += score[m];
}
}
}
for(int k=0 ; k<a ; k++) {
if(A[k]=="A") {
if(21-sum_A>10) {
sum_A+=11;
}else {
sum_A+=1;
}
}
}
//cout << sum_A << endl;
int sum_B=0;
for(int k=0 ; k<b ; k++) {
for(int m=0 ; m<13 ; m++) {
if(B[k]==pocker[m]) {
sum_B += score[m];
}
}
}
for(int k=0 ; k<b ; k++) {
if(B[k]=="A") {
if(21-sum_B>10) {
sum_B+=11;
}else {
sum_B+=1;
}
}
}
//cout << sum_B << endl;
if((sum_A>21) && (sum_B<21)) {
cout << "B" << endl;
}
if((sum_A<21) && (sum_B>21)) {
cout << "A" << endl;
}
if((sum_A>21) && (sum_B>21)) {
cout << "Draw" << endl;
}
if((sum_A==sum_B) && (sum_A<22) && (sum_B<22)){
cout << "Draw" << endl;
}
if((sum_A>sum_B) && (sum_A<22) && (sum_B<22)) {
cout << "A" << endl;
}
if((sum_B>sum_A) && (sum_A<22) && (sum_B<22)) {
cout << "B" << endl;
}
cout << sum_A << " " << sum_B << endl;
} |
# 2015878, 2024-09-28 10:52:51, PPPPP--PPPP---P-P-P- (60%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) score_b +=10;
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b<= 10) {
score_b += 11;
} else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
if (score_a > 21 && score_b > 21 || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2015887, 2024-09-28 10:53:50, PPPPP--PPPP---P-P-P- (60%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) score_b +=10;
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b<= 10) {
score_b += 11;
} else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2015957, 2024-09-28 10:59:36, PPPPP--PPP----P---P- (50%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b<= 10) {
score_b += 11;}
else if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {score_b +=10;}
else if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2015961, 2024-09-28 10:59:57, PPPPP--PPPP---P-P-P- (60%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) score_b +=10;
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b<= 10) {
score_b += 11;
} else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016305, 2024-09-28 11:32:55, ----P----P-----P--P- (20%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
bool x =false;
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11; x = true;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
if (x) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {score_b +=10;}
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016313, 2024-09-28 11:33:20, PPPPP--PPPP---P-P-P- (60%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) score_b +=10;
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b<= 10) {
score_b += 11;
} else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016496, 2024-09-28 11:45:32, PPPPP--PPP----PP--P- (55%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
int count_A = 0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" ) count_A++;
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {
score_b +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b){
cout<<"A"<<endl;
} else if (score_a < score_b){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016513, 2024-09-28 11:46:51, P-PPP--P------PP---- (35%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
int count_A = 0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" ) count_A++;
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {
score_b +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b && score_a < 21){
cout<<"A"<<endl;
} else if (score_a < score_b && score_b < 21){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016519, 2024-09-28 11:47:17, PPPPP--PPP----PP--P- (55%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
int count_A = 0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" ) count_A++;
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {
score_b +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (score_a > score_b && score_a <= 21){
cout<<"A"<<endl;
} else if (score_a < score_b && score_b <= 21){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016549, 2024-09-28 11:49:28, PPPPPPPPPP-PP-PP-PP- (80%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
int count_A = 0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" ) count_A++;
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {
score_b +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (21 < score_b ){
cout<<"A"<<endl;
} else if (score_a > 21 ){
cout<<"B"<<endl;
} else if (score_a > score_b ){
cout<<"A"<<endl;
} else if (score_a < score_b ){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016598, 2024-09-28 11:51:53, PPPPPPPPP---P-PP-PP- (70%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
int count_A = 0, count_Aa = 0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<b; i++){
if(A[i] == "A" ) count_Aa++;
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) {score_a +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" ) count_A++;
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {
score_b +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if(count_A == 3) score_b = 13;
if(count_Aa == 3) score_a = 13;
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (21 < score_b ){
cout<<"A"<<endl;
} else if (score_a > 21 ){
cout<<"B"<<endl;
} else if (score_a > score_b ){
cout<<"A"<<endl;
} else if (score_a < score_b ){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} | # 2016603, 2024-09-28 11:52:10, PPPPPPPPPP-PP-PP-PP- (80%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string A[5];
string B[5];
int score_a = 0, score_b =0;
int count_A = 0;
for(int i=0 ;i<a; i++){
cin>>A[i];
}
for(int i=0 ;i<b; i++){
cin>>B[i];
}
for(int i=0 ;i<a; i++){
if(A[i] == "K" || A[i] == "Q" || A[i] == "J" ) score_a +=10;
}
for(int i=0 ;i<a; i++){
if(A[i] != "K" && A[i] != "Q" && A[i] != "J" && A[i] != "A") {
int x = stoi(A[i]);
score_a += x;
}
}
for(int i=0 ;i<a; i++){
if(A[i] == "A" && score_a <= 10) {
score_a += 11;
} else if (A[i] == "A" && score_a > 10){
score_a += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" ) count_A++;
}
for(int i=0 ;i<b; i++){
if(B[i] == "A" && score_b <= 10) {
score_b += 11;}
else if (B[i] == "A" && score_b > 10){
score_b += 1;
}
}
for(int i=0 ;i<b; i++){
if(B[i] == "K" || B[i] == "Q" || B[i] == "J" ) {
score_b +=10;
if(count_A == 2) score_b -= 10;
}
}
for(int i=0 ;i<b; i++){
if(B[i] != "K" && B[i] != "Q" && B[i] != "J" && B[i] != "A") {
int y = stoi(B[i]);
score_b += y;
}
}
if ((score_a > 21 && score_b > 21) || score_a == score_b ){
cout<<"Draw"<<endl;
} else if (21 < score_b ){
cout<<"A"<<endl;
} else if (score_a > 21 ){
cout<<"B"<<endl;
} else if (score_a > score_b ){
cout<<"A"<<endl;
} else if (score_a < score_b ){
cout<<"B"<<endl;
}
cout<<score_a<<" "<<score_b;
} |
# 2015675, 2024-09-28 10:31:06, ---------PP--P-PP-PP (35%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int x = stoi(e);
sumB += x;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}
}
if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}
if (sumA > sumB)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
}
} | # 2015722, 2024-09-28 10:34:45, PPPPP--------------- (25%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}
}else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}
if (sumA > sumB)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
}else
{
if( sumA > sumB)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}else if (sumA < sumB)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
}
} | # 2015856, 2024-09-28 10:50:59, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}else sumA = sumA;
}else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}else sumB = sumB;
// if(na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if(na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if( na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }
if (sumA > sumB && sumA <= 21 && na > nb)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB && sumB <= 21 && nb > na)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if(sumA == sumB || sumA >= 21 && sumB >=21 )
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
// }else
// {
// if( sumA > sumB)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// }else if (sumA < sumB)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// }
// else if(sumA == sumB)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
}
} | # 2015861, 2024-09-28 10:51:25, PPPPP--------------- (25%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}else sumA = sumA;
}else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}else sumB = sumB;
// if(na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if(na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if( na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }
if (sumA > sumB && sumA <= 21 && na > nb)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB && sumB <= 21 && nb > na)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if(sumA == sumB || sumA >= 21 && sumB >=21 )
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
}else
{
if( sumA > sumB)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}else if (sumA < sumB)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if(sumA == sumB)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
}
} | # 2015951, 2024-09-28 10:58:50, -PPPP--P------P-P--- (35%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}
else
sumA = sumA;
}
else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}
else
sumB = sumB;
}
// if(na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if(na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if( na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }
if (sumA > sumB && sumA <= 21 && na > nb)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB && sumB <= 21 && nb > na)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if (sumA == sumB || sumA >= 21 && sumB >= 21)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
else
{
if (na > nb)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (na < nb)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if (na == nb)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
}
} | # 2016035, 2024-09-28 11:06:20, PPPPPPPPP-PPP-PPPP-- (80%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}
else
sumA = sumA;
}
else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}
else
sumB = sumB;
}
// if(na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if(na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if( na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }
if (sumA > sumB && sumA <= 21 )
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB && sumB <= 21 )
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if (sumA == sumB || sumA >= 21 && sumB >= 21)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}else if(sumA >=21)
{
if(sumB <= 21)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
}else if(sumB >=21)
{
if(sumA <= 21)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
}else if(sumA >=21 && sumB >= 21 || na == nb)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
// else
// {
// if (na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// }
// else if (na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// }
// else if (na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// }
// }
} | # 2016037, 2024-09-28 11:07:04, PPPPPPPPP-PPP-PPPP-- (80%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}
else
sumA = sumA;
}
else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}
else
sumB = sumB;
}
// if(na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if(na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if( na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }
if (sumA > sumB && sumA <= 21 )
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB && sumB <= 21 )
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if (sumA == sumB || sumA >= 21 && sumB >= 21)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}else if(sumA >=21|| na > nb)
{
if(sumB <= 21)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
}else if(sumB >=21 || nb > na)
{
if(sumA <= 21)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
}else if(sumA >=21 && sumB >= 21 || na == nb)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
// else
// {
// if (na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// }
// else if (na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// }
// else if (na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// }
// }
} | # 2016043, 2024-09-28 11:07:41, PPPPPPPPP-PPP-PPPP-- (80%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> A;
vector<string> B;
int sumA = 0;
int sumB = 0;
string a, b, final;
int na, nb, faA = 0, faB = 0;
cin >> na >> nb;
for (int i = 0; i < na; i++)
{
cin >> a;
A.push_back(a);
// cout << a<< " ";
}
for (int i = 0; i < nb; i++)
{
cin >> b;
B.push_back(b);
// cout << b << " ";
}
for (auto e : A)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faA = 1;
e = "1";
}
int x = stoi(e);
sumA += x;
}
for (auto e : B)
{
if (e == "K" || e == "J" || e == "Q")
{
e = "10";
}
else if (e == "A")
{
faB = 1;
e = "1";
}
int y = stoi(e);
sumB += y;
}
if (faA == 1)
{
if (sumA + 10 <= 21)
{
sumA += 10;
}
else
sumA = sumA;
}
else if (faB == 1)
{
if (sumB + 10 <= 21)
{
sumB += 10;
}
else
sumB = sumB;
}
// if(na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if(na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }else if( na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// return 0;
// }
if (sumA > sumB && sumA <= 21 )
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
else if (sumA < sumB && sumB <= 21 )
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
else if (sumA == sumB || sumA >= 21 && sumB >= 21)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}else if(sumA >=21|| na > nb)
{
if(sumB <= 21)
{
cout << "B" << endl;
cout << sumA << " " << sumB;
}
}else if(sumB >=21 || nb > na)
{
if(sumA <= 21)
{
cout << "A" << endl;
cout << sumA << " " << sumB;
}
}else if(sumA >=21 && sumB >= 21 || na == nb||sumA == sumB)
{
cout << "Draw" << endl;
cout << sumA << " " << sumB;
}
// else
// {
// if (na > nb)
// {
// cout << "A" << endl;
// cout << sumA << " " << sumB;
// }
// else if (na < nb)
// {
// cout << "B" << endl;
// cout << sumA << " " << sumB;
// }
// else if (na == nb)
// {
// cout << "Draw" << endl;
// cout << sumA << " " << sumB;
// }
// }
} |
# 2015285, 2024-09-28 09:52:05, P-PPP-----P---P-P--- (35%)
#include<iostream>
#include<cmath>
using namespace std;
int value(char x){
int y;
if( x =='2'){
y=2;
}
else if(x=='3'){
y=3;
}
else if( x=='4'){
y=4;
}
else if(x=='5'){
y=5;
}
else if(x=='6'){
y=6;
}
else if(x=='7'){
y=7;
}
else if(x=='8'){
y=8;
}
else if(x=='9'){
y=9;
}
else if(x=='10'){
y=10;
}
else if(x=='J'){
y=10;
}
else if(x=='Q'){
y=10;
}
else if(x=='K'){
y=10;
}
return y;
}
int main(){
int a,b;
cin>>a>>b;
char carda[100];
char cardb[100];
for(int i=0;i<a;i++){
cin>>carda[i];
}
for(int i=0;i<b;i++){
cin>>cardb[i];
}
int suma=0;
for(int i =0;i<a;i++){
if(carda[i]!='A'){
suma+=value(carda[i]);
}
}
for(int i=0;i<a;i++){
int y=0;
if(carda[i]=='A'){
if(suma<=10){
y=11;
suma+=y;
}
else if(suma>10){
y=1;
suma+=y;
}
}
}
int sumb=0;
for(int i =0;i<b;i++){
if(cardb[i]!='A'){
sumb+=value(cardb[i]);
}
}
for(int i=0;i<b;i++){
int y=0;
if(cardb[i]=='A'){
if(sumb<=10){
y=11;
sumb+=y;
}
else if(sumb>10){
y=1;
sumb+=y;
}
}
}
if(suma>sumb){
cout<<'A'<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma < sumb){
cout<<'B'<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma == sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2015367, 2024-09-28 09:59:06, P-PPP-P---PPP-P-PP-- (55%)
#include<iostream>
#include<cmath>
using namespace std;
int value(char x){
int y;
if( x =='2'){
y=2;
}
else if(x=='3'){
y=3;
}
else if( x=='4'){
y=4;
}
else if(x=='5'){
y=5;
}
else if(x=='6'){
y=6;
}
else if(x=='7'){
y=7;
}
else if(x=='8'){
y=8;
}
else if(x=='9'){
y=9;
}
else if(x =='10'){
y=10;
}
else if(x=='J'){
y=10;
}
else if(x=='Q'){
y=10;
}
else if(x=='K'){
y=10;
}
return y;
}
int main(){
int a,b;
cin>>a>>b;
char carda[100];
char cardb[100];
for(int i=0;i<a;i++){
cin>>carda[i];
}
for(int i=0;i<b;i++){
cin>>cardb[i];
}
int suma=0;
for(int i =0;i<a;i++){
if(carda[i]!='A'){
suma+=value(carda[i]);
}
}
for(int i=0;i<a;i++){
int y=0;
if(carda[i]=='A'){
if(suma<=10){
y=11;
suma+=y;
}
else if(suma>10&&suma!=20){
y=1;
suma+=y;
}
else if(suma==20){
y=1;
suma+=y;
}
}
}
int sumb=0;
for(int i =0;i<b;i++){
if(cardb[i]!='A'){
sumb+=value(cardb[i]);
}
}
for(int i=0;i<b;i++){
int y=0;
if(cardb[i]=='A'){
if(sumb<=10){
y=11;
sumb+=y;
}
else if(sumb>10&&sumb!=20){
y=1;
sumb+=y;
}
else if(sumb==20){
y=1;
sumb+=y;
}
}
}
if(suma>sumb&&suma<=21&&sumb<=21){
cout<<'A'<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma < sumb&&suma<=21&&sumb<=21){
cout<<'B'<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma == sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma>21&&sumb<=21){
cout<<'B'<<endl;
cout<<suma<<" "<<sumb;
}
else if(sumb>21&&suma<=21){
cout<<'A'<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2015406, 2024-09-28 10:02:34, PPPPPPP-PPPPP-P-PPP- (80%)
#include<iostream>
#include<cmath>
using namespace std;
int value(string x){
int y;
if( x =="2"){
y=2;
}
else if(x=="3"){
y=3;
}
else if( x=="4"){
y=4;
}
else if(x=="5"){
y=5;
}
else if(x=="6"){
y=6;
}
else if(x=="7"){
y=7;
}
else if(x=="8"){
y=8;
}
else if(x=="9"){
y=9;
}
else if(x =="10"){
y=10;
}
else if(x=="J"){
y=10;
}
else if(x=="Q"){
y=10;
}
else if(x=="K"){
y=10;
}
return y;
}
int main(){
int a,b;
cin>>a>>b;
string carda[100];
string cardb[100];
for(int i=0;i<a;i++){
cin>>carda[i];
}
for(int i=0;i<b;i++){
cin>>cardb[i];
}
int suma=0;
for(int i =0;i<a;i++){
if(carda[i]!="A"){
suma+=value(carda[i]);
}
}
for(int i=0;i<a;i++){
int y=0;
if(carda[i]=="A"){
if(suma<=10){
y=11;
suma+=y;
}
else if(suma>10&&suma!=20){
y=1;
suma+=y;
}
else if(suma==20){
y=1;
suma+=y;
}
}
}
int sumb=0;
for(int i =0;i<b;i++){
if(cardb[i]!="A"){
sumb+=value(cardb[i]);
}
}
for(int i=0;i<b;i++){
int y=0;
if(cardb[i]=="A"){
if(sumb<=10){
y=11;
sumb+=y;
}
else if(sumb>10&&sumb!=20){
y=1;
sumb+=y;
}
else if(sumb==20){
y=1;
sumb+=y;
}
}
}
if(suma>sumb&&suma<=21&&sumb<=21){
cout<<'A'<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma < sumb&&suma<=21&&sumb<=21){
cout<<'B'<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma == sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
else if(suma>21&&sumb<=21){
cout<<'B'<<endl;
cout<<suma<<" "<<sumb;
}
else if(sumb>21&&suma<=21){
cout<<'A'<<endl;
cout<<suma<<" "<<sumb;
}
} |
# 2017445, 2024-09-28 13:29:55, PPPPPPP-PPPPP-P-PPP- (80%)
#include<iostream>
#include<string>
#include<vector>
using namespace std;
// long long calculateScore(vector<string> s){
// long long score = 0;
// for(int r=1; r<=2; r++){
// if(r==1){
// for(int i=0; i<s.size(); i++){
// string c = s[i];
// if(c == "A"){
// continue;
// }else if(c >= '2' && c <= '9'){
// }else if(){
// }
// }
// }else{
// }
// }
// return 0;
// }
int main(){
int am_a, am_b; cin >> am_a >> am_b;
vector<string> card_a;
vector<string> card_b;
string buff;
// inout manipulate
for(int i=0; i<am_a; i++){
cin >> buff;
card_a.push_back(buff);
}
for(int i=0; i<am_b; i++){
cin >> buff;
card_b.push_back(buff);
}
// Calculate sore
long long score_a = 0;
long long score_b = 0;
for(int r=1; r<=2; r++){
if(r==1){
// check not a
for(int i=0; i<card_a.size(); i++){
string c = card_a[i];
// Calculate score
if(c == "2" || c == "3" || c == "4" || c == "5" || c == "6" || c == "7" || c == "8" || c == "9" || c == "10"){
score_a+=stoll(c);
}else if(c == "J" || c == "Q" || c == "K"){
score_a+=10;
}
}
}else{
// check A
bool is_cntA = false;
for(int i=0; i<card_a.size(); i++){
string c = card_a[i];
// Calculate score
if(c == "A"){
if(score_a+11 <= 21 && is_cntA == false){
if(score_a+11 == 21 && is_cntA == true){
score_a += 1;
}else{
if(is_cntA == false){
score_a += 11;
}else{
score_a += 1;
}
}
is_cntA = true;
}else{
score_a += 1;
}
}
}
}
}
// seperated player
for(int r=1; r<=2; r++){
if(r==1){
// check not B
for(int i=0; i<card_b.size(); i++){
string c = card_b[i];
// Calculate score
if(c == "2" || c == "3" || c == "4" || c == "5" || c == "6" || c == "7" || c == "8" || c == "9" || c == "10"){
score_b+=stoll(c);
}else if(c == "J" || c == "Q" || c == "K"){
score_b+=10;
}
}
}else{
// check B
bool is_cntB = false;
for(int i=0; i<card_b.size(); i++){
string c = card_b[i];
// Calculate score
if(c == "A"){
if(score_b+11 <= 21 && is_cntB == false){
if(score_b+11 == 21 && is_cntB == true){
score_b += 1;
}else{
if(is_cntB == false){
score_b += 11;
}else{
score_b += 1;
}
}
is_cntB = true;
}else{
score_b += 1;
}
}
}
}
}
if(score_a == score_b){
cout << "Draw\n";
}else if(score_a > score_b){
if(score_a > 21){
cout << "B\n";
}else{
cout << "A\n";
}
}else if(score_a < score_b){
if(score_b > 21){
cout << "A\n";
}else{
cout << "B\n";
}
}
cout << score_a << " " << score_b;
return 0;
} |
# 2015596, 2024-09-28 10:22:11, P-PPPPPP----P-P--P-- (50%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a1, a2;
cin >> a1 >> a2;
vector<string> cardA, cardB;
vector<string> numCheck = {"2","3","4","5","6","7","8","9","10"};
vector<string> letterCheck = {"J","Q","K"};
int totalA = 0, totalB = 0;
int count = 0;
//card A
for (int i = 0; i < a1; ++i) {
string inputA;
cin >> inputA;
cardA.push_back(inputA);
}
//card B
for (int i = 0; i < a2; ++i) {
string inputB;
cin >> inputB;
cardB.push_back(inputB);
}
for (int i = 0; i < cardA.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardA[i]) {
string tempA = cardA[i];
int tempNum = stoi(tempA);
totalA += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardA[i]) {
totalA += 10;
count++;
}
}
if (cardA[i] == "A") {
if (count == 0) {
totalA += 11;
count++;
} else {
totalA += 1;
}
}
}
count = 0;
for (int i = 0; i < cardB.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardB[i]) {
string tempB= cardB[i];
int tempNum = stoi(tempB);
totalB += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardB[i]) {
totalB += 10;
count++;
}
}
if (cardB[i] == "A") {
if (count == 0) {
totalB += 11;
count++;
} else {
totalB += 1;
}
}
}
if (totalA < 21 && totalB < 21) {
if (totalA > totalB) {
cout << "A" << endl;
} else if (totalA < totalB) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
} else if (totalA < 21 && totalB > 21) {
cout << "A" << endl;
} else if (totalA > 21 && totalB < 21) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << totalA << " " << totalB << endl;
} | # 2015698, 2024-09-28 10:33:02, PPPPPPPPP-P-P-PPPP-- (75%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a1, a2;
cin >> a1 >> a2;
vector<string> cardA, cardB;
vector<string> numCheck = {"2","3","4","5","6","7","8","9","10"};
vector<string> letterCheck = {"J","Q","K"};
int totalA = 0, totalB = 0;
int count = 0;
//card A
for (int i = 0; i < a1; ++i) {
string inputA;
cin >> inputA;
cardA.push_back(inputA);
}
//card B
for (int i = 0; i < a2; ++i) {
string inputB;
cin >> inputB;
cardB.push_back(inputB);
}
for (int i = 0; i < cardA.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardA[i]) {
string tempA = cardA[i];
int tempNum = stoi(tempA);
totalA += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardA[i]) {
totalA += 10;
count++;
}
}
if (cardA[i] == "A") {
if (count == 0) {
totalA += 11;
count++;
} else {
totalA += 1;
}
}
}
int count2 = 0;
for (int i = 0; i < cardB.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardB[i]) {
string tempB= cardB[i];
int tempNum = stoi(tempB);
totalB += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardB[i]) {
totalB += 10;
count2++;
}
}
if (cardB[i] == "A") {
if (count == 0) {
totalB += 11;
count2++;
} else {
totalB += 1;
}
}
}
if (totalA <= 21 && totalB <= 21) {
if (totalA > totalB) {
cout << "A" << endl;
} else if (totalA < totalB) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
} else if (totalA <= 21 && totalB > 21) {
cout << "A" << endl;
} else if (totalA > 21 && totalB <= 21) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << totalA << " " << totalB << endl;
} | # 2016113, 2024-09-28 11:14:40, PPPPPPPPP---P-P--P-- (60%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a1, a2;
cin >> a1 >> a2;
vector<string> cardA, cardB;
vector<string> numCheck = {"2","3","4","5","6","7","8","9","10"};
vector<string> letterCheck = {"J","Q","K"};
int totalA = 0, totalB = 0;
int count = 0;
//card A
for (int i = 0; i < a1; ++i) {
string inputA;
cin >> inputA;
cardA.push_back(inputA);
}
//card B
for (int i = 0; i < a2; ++i) {
string inputB;
cin >> inputB;
cardB.push_back(inputB);
}
for (int i = 0; i < cardA.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardA[i]) {
string tempA = cardA[i];
int tempNum = stoi(tempA);
totalA += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardA[i]) {
totalA += 10;
count++;
}
}
if (cardA[i] == "A") {
if (count == 0) {
totalA += 11;
count++;
} else {
totalA += 1;
}
}
}
int count2 = 0;
for (int i = 0; i < cardB.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardB[i]) {
string tempB= cardB[i];
int tempNum = stoi(tempB);
totalB += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardB[i]) {
totalB += 10;
count2++;
}
}
if (cardB[i] == "A") {
if (count2 == 0) {
totalB += 11;
count2++;
cout << count2 << endl;
} else {
totalB += 1;
}
}
}
if (totalA <= 21 && totalB <= 21) {
if (totalA > totalB) {
cout << "A" << endl;
} else if (totalA < totalB) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
} else if (totalA <= 21 && totalB > 21) {
cout << "A" << endl;
} else if (totalA > 21 && totalB <= 21) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << totalA << " " << totalB << endl;
} | # 2016114, 2024-09-28 11:14:58, PPPPPPPPP-P-P-PPPP-- (75%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a1, a2;
cin >> a1 >> a2;
vector<string> cardA, cardB;
vector<string> numCheck = {"2","3","4","5","6","7","8","9","10"};
vector<string> letterCheck = {"J","Q","K"};
int totalA = 0, totalB = 0;
int count = 0;
//card A
for (int i = 0; i < a1; ++i) {
string inputA;
cin >> inputA;
cardA.push_back(inputA);
}
//card B
for (int i = 0; i < a2; ++i) {
string inputB;
cin >> inputB;
cardB.push_back(inputB);
}
for (int i = 0; i < cardA.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardA[i]) {
string tempA = cardA[i];
int tempNum = stoi(tempA);
totalA += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardA[i]) {
totalA += 10;
count++;
}
}
if (cardA[i] == "A") {
if (count == 0) {
totalA += 11;
count++;
} else {
totalA += 1;
}
}
}
int count2 = 0;
for (int i = 0; i < cardB.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardB[i]) {
string tempB= cardB[i];
int tempNum = stoi(tempB);
totalB += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardB[i]) {
totalB += 10;
count2++;
}
}
if (cardB[i] == "A") {
if (count == 0) {
totalB += 11;
count2++;
} else {
totalB += 1;
}
}
}
if (totalA <= 21 && totalB <= 21) {
if (totalA > totalB) {
cout << "A" << endl;
} else if (totalA < totalB) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
} else if (totalA <= 21 && totalB > 21) {
cout << "A" << endl;
} else if (totalA > 21 && totalB <= 21) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << totalA << " " << totalB << endl;
} | # 2016116, 2024-09-28 11:15:13, PPPPPPPPP---P-P--PP- (65%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a1, a2;
cin >> a1 >> a2;
vector<string> cardA, cardB;
vector<string> numCheck = {"2","3","4","5","6","7","8","9","10"};
vector<string> letterCheck = {"J","Q","K"};
int totalA = 0, totalB = 0;
int count = 0;
//card A
for (int i = 0; i < a1; ++i) {
string inputA;
cin >> inputA;
cardA.push_back(inputA);
}
//card B
for (int i = 0; i < a2; ++i) {
string inputB;
cin >> inputB;
cardB.push_back(inputB);
}
for (int i = 0; i < cardA.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardA[i]) {
string tempA = cardA[i];
int tempNum = stoi(tempA);
totalA += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardA[i]) {
totalA += 10;
count++;
}
}
if (cardA[i] == "A") {
if (count == 0) {
totalA += 11;
count++;
} else {
totalA += 1;
}
}
}
int count2 = 0;
for (int i = 0; i < cardB.size(); ++i) {
for (int j = 0; j < numCheck.size(); ++j) {
if(numCheck[j] == cardB[i]) {
string tempB= cardB[i];
int tempNum = stoi(tempB);
totalB += tempNum;
}
}
for (int k = 0; k < letterCheck.size(); ++k) {
if(letterCheck[k] == cardB[i]) {
totalB += 10;
count2++;
}
}
if (cardB[i] == "A") {
if (count2 == 0) {
totalB += 11;
count2++;
} else {
totalB += 1;
}
}
}
if (totalA <= 21 && totalB <= 21) {
if (totalA > totalB) {
cout << "A" << endl;
} else if (totalA < totalB) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
} else if (totalA <= 21 && totalB > 21) {
cout << "A" << endl;
} else if (totalA > 21 && totalB <= 21) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << totalA << " " << totalB << endl;
} |
# 2017185, 2024-09-28 13:06:17, PP--PPPPP---P----PP- (50%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int A , B ;
cin>>A>>B ;
int sum_a = 0 , sum_b = 0 ;
for(int i = 0;i<A;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_a += 10 ;
}
else if(num == "A"){ //A
if(sum_a + 11 <= 21){
sum_a += 11 ;
}
else{
sum_a += 1 ;
}
}
else{
sum_a += stoi(num) ;
}
}
for(int i = 0;i<B;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_b += 10 ;
}
else if(num == "A"){ //A
if(sum_b + 11 <= 21){
sum_b += 11 ;
}
else{
sum_b += 1 ;
}
}
else{
sum_b += stoi(num) ;
}
}
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} | # 2017201, 2024-09-28 13:07:35, PPPPPPPPP---P-P--PP- (65%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int A , B ;
cin>>A>>B ;
int sum_a = 0 , sum_b = 0 ;
for(int i = 0;i<A;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_a += 10 ;
}
else if(num == "A"){ //A
if(sum_a + 11 <= 21){
sum_a += 11 ;
}
else{
sum_a += 1 ;
}
}
else{
sum_a += stoi(num) ;
}
}
for(int i = 0;i<B;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_b += 10 ;
}
else if(num == "A"){ //A
if(sum_b + 11 <= 21){
sum_b += 11 ;
}
else{
sum_b += 1 ;
}
}
else{
sum_b += stoi(num) ;
}
}
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a == sum_b){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} | # 2017307, 2024-09-28 13:16:50, PPPPPPPPP---P-P----- (55%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int A , B ;
cin>>A>>B ;
int sum_a = 0 , sum_b = 0 ;
for(int i = 0;i<A;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_a += 10 ;
}
else if(num == "A"){ //A
if(sum_a + 11 <= 21){
sum_a += 11 ;
}
else if(sum_a + 11 > 21 && i == 2){
sum_a -= 10 ;
sum_a += 1 ;
}
else{
sum_a += 1 ;
}
}
else{
sum_a += stoi(num) ;
}
}
for(int i = 0;i<B;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_b += 10 ;
}
else if(num == "A"){ //A
if(sum_b + 11 <= 21){
sum_b += 11 ;
}
else if(sum_b + 11 > 21 && i == 2){
sum_b -= 10 ;
sum_b += 1 ;
}
else{
sum_b += 1 ;
}
}
else{
sum_b += stoi(num) ;
}
}
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a == sum_b){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} | # 2017312, 2024-09-28 13:17:20, PPPPPPPPP---P-P--PP- (65%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int A , B ;
cin>>A>>B ;
int sum_a = 0 , sum_b = 0 ;
for(int i = 0;i<A;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_a += 10 ;
}
else if(num == "A"){ //A
if(sum_a + 11 <= 21){
sum_a += 11 ;
}
else{
sum_a += 1 ;
}
}
else{
sum_a += stoi(num) ;
}
}
for(int i = 0;i<B;i++){
string num ; cin>>num ;
if(num == "Q" || num =="J" || num == "K"){
sum_b += 10 ;
}
else if(num == "A"){ //A
if(sum_b + 11 <= 21){
sum_b += 11 ;
}
else{
sum_b += 1 ;
}
}
else{
sum_b += stoi(num) ;
}
}
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a == sum_b){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} | # 2018227, 2024-09-28 14:44:17, PPPPPPPPPP--P-P--PP- (70%)
#include<bits/stdc++.h>
#include<vector>
using namespace std ;
int findsum(vector<string> s){
int sum = 0 ;
for(int i = 0 ; i<s.size() ;i++){
if(s[i] >= "0" && s[i]<="9"){
sum += stoi(s[i]) ;
}
else if(s[i] == "Q" || s[i] == "J" || s[i] == "K" || s[i] == "10"){
sum += 10 ;
}
else if(s[i] == "A"){
if(sum + 11 > 21){
sum += 1 ;
}
else{
sum += 11 ;
}
}
}
return sum ;
}
int main(){
int na , nb ;
cin>>na>>nb ;
vector<string> A ;
vector<string> B ;
string temp ;
for (int i = 0 ;i<na ;i++){
cin>>temp;
A.push_back(temp) ;
}
for(int i = 0 ;i<nb ; i++){
cin>>temp ;
B.push_back(temp) ;
}
sort(A.begin(),A.end()) ;
sort(B.begin(),B.end()) ;
int sum_a = findsum(A) ;
int sum_b = findsum(B) ;
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a == sum_b){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} | # 2018302, 2024-09-28 14:51:30, PPPPPPPP--PP-------- (50%)
#include<bits/stdc++.h>
#include<vector>
using namespace std ;
int findsum(vector<string> s){
int sum = 0 ;
int tod1 = 0 , tod2 = 0 ;
for(int i = 0 ; i<s.size() ;i++){
if(s[i] >= "0" && s[i]<="9"){
sum += stoi(s[i]) ;
}
else if(s[i] == "Q" || s[i] == "J" || s[i] == "K" || s[i] == "10"){
sum += 10 ;
}
else if(s[i] == "A"){
tod1 += 1;
tod2 += 11 ;
}
}
int sum1 = sum + tod1 ;
int sum2 = sum + tod2 ;
if(sum2 < 21) return sum2 ;
return sum1 ;
}
int main(){
int na , nb ;
cin>>na>>nb ;
vector<string> A ;
vector<string> B ;
string temp ;
for (int i = 0 ;i<na ;i++){
cin>>temp;
A.push_back(temp) ;
}
for(int i = 0 ;i<nb ; i++){
cin>>temp ;
B.push_back(temp) ;
}
sort(A.begin(),A.end()) ;
sort(B.begin(),B.end()) ;
int sum_a = findsum(A) ;
int sum_b = findsum(B) ;
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a == sum_b){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} | # 2018319, 2024-09-28 14:53:03, PPPPPPPP--PP-------- (50%)
#include<bits/stdc++.h>
#include<vector>
using namespace std ;
int findsum(vector<string> s){
int sum = 0 ;
int tod1 = 0 , tod2 = 0 ;
for(int i = 0 ; i<s.size() ;i++){
if(s[i] >= "0" && s[i]<="9"){
sum += stoi(s[i]) ;
}
else if(s[i] == "Q" || s[i] == "J" || s[i] == "K" || s[i] == "10"){
sum += 10 ;
}
else if(s[i] == "A"){
tod1 += 1;
tod2 += 11 ;
}
}
int sum1 = sum + tod1 ;
int sum2 = sum + tod2 ;
if(sum2>sum1){
if(sum2<21){
return sum2 ;
}
else{
return sum1 ;
}
}
else{
return sum1 ;
}
}
int main(){
int na , nb ;
cin>>na>>nb ;
vector<string> A ;
vector<string> B ;
string temp ;
for (int i = 0 ;i<na ;i++){
cin>>temp;
A.push_back(temp) ;
}
for(int i = 0 ;i<nb ; i++){
cin>>temp ;
B.push_back(temp) ;
}
sort(A.begin(),A.end()) ;
sort(B.begin(),B.end()) ;
int sum_a = findsum(A) ;
int sum_b = findsum(B) ;
if(sum_a > 21 && sum_b >21){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a == sum_b){
cout<<"Draw"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else if(sum_a > sum_b){
if(sum_a > 21){
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
else if(sum_a < sum_b){
if(sum_b > 21){
cout<<"A"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
else{
cout<<"B"<<endl ;
cout<<sum_a<<' '<<sum_b ;
}
}
} |
# 2015708, 2024-09-28 10:33:29, PPPPP--------------- (25%)
#include<bits//stdc++.h>
using namespace std;
int main(){
int a,b,point[14]={11,2,3,4,5,6,7,8,9,10,10,10,10,11},sumA=0,sumB=0;
cin>>a>>b;
string arrA[a],arrB[b],card[14]={"a","2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
cin>>arrA[i];
}
for(int i=0;i<b;i++){
cin>>arrB[i];
}
for(int j=0;j<a;j++){
for(int i=0;i<14;i++){
if(arrA[j]==card[i]){
sumA+=point[i];
break;
}
}
}
for(int j=0;j<b;j++){
for(int i=0;i<14;i++){
if(arrB[j]==card[i]){
sumB+=point[i];
break;
}
}
}
if(sumA>sumB){
cout<<"A"<<endl;
}
else if(sumA<sumB){
cout<<"B"<<endl;
}else if(sumA==sumB){
cout<<"Draw"<<endl;
}
cout<<sumA<<" "<<sumB;
return 0;
} | # 2015798, 2024-09-28 10:44:01, PPPPPPPPP----------- (45%)
#include<bits//stdc++.h>
using namespace std;
int main(){
int a,b,point[14]={11,2,3,4,5,6,7,8,9,10,10,10,10,11},sumA=0,sumB=0;
cin>>a>>b;
string arrA[a],arrB[b],card[14]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
cin>>arrA[i];
}
for(int i=0;i<b;i++){
cin>>arrB[i];
}
for(int j=0;j<a;j++){
for(int i=0;i<14;i++){
if(arrA[j]==card[i]){
sumA+=point[i];
break;
}
}
}
for(int j=0;j<b;j++){
for(int i=0;i<14;i++){
if(arrB[j]==card[i]){
sumB+=point[i];
break;
}
}
}
int sumA1=sumA;
int sumB1=sumB;
if(sumA>21){
sumA1=0;
}
if(sumB>21){
sumB1=0;
}
if(sumA1>sumB1){
cout<<"A"<<endl;
}
else if(sumA1<sumB1){
cout<<"B"<<endl;
}else if(sumA==sumB||(sumB>21&&sumB>21)){
cout<<"Draw"<<endl;
}
cout<<sumA<<" "<<sumB;
return 0;
} | # 2015871, 2024-09-28 10:52:27, PPPPPPxPPP-Px-x--Px- (55%)
#include<bits//stdc++.h>
using namespace std;
int main(){
int a,b,point[14]={11,2,3,4,5,6,7,8,9,10,10,10,10,11},sumA=0,sumB=0,countA1=0,countA2;
cin>>a>>b;
string arrA[a],arrB[b],card[14]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
cin>>arrA[i];
}
for(int i=0;i<b;i++){
cin>>arrB[i];
}
for(int i=0;i<b;i++){
if(arrA[i]=="A"){
countA1+=1;
}
}
for(int i=0;i<b;i++){
if(arrB[i]=="A"){
countA2+=1;
}
}
for(int j=0;j<a;j++){
for(int i=0;i<14;i++){
if(arrA[j]==card[i]){
sumA+=point[i];
while(countA1>0&&sumA>21){
sumA=sumA-10;
countA1--;
}
break;
}
}
}
for(int j=0;j<b;j++){
for(int i=0;i<14;i++){
if(arrB[j]==card[i]){
sumB+=point[i];
while(countA2>0&&sumB>21){
sumA=sumA-10;
countA2--;
}
break;
}
}
}
int sumA1=sumA;
int sumB1=sumB;
if(sumA>21){
sumA1=0;
}
if(sumB>21){
sumB1=0;
}
if(sumA1>sumB1){
cout<<"A"<<endl;
}
else if(sumA1<sumB1){
cout<<"B"<<endl;
}else if(sumA==sumB||(sumB>21&&sumB>21)){
cout<<"Draw"<<endl;
}
cout<<sumA<<" "<<sumB;
return 0;
} | # 2015989, 2024-09-28 11:01:50, PPPPPPPPPP-PP-P--P-- (70%)
#include<bits//stdc++.h>
using namespace std;
int main(){
int a,b,point[14]={11,2,3,4,5,6,7,8,9,10,10,10,10,11},sumA=0,sumB=0,countA1=0,countA2;
cin>>a>>b;
string arrA[a],arrB[b],card[14]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
cin>>arrA[i];
}
for(int i=0;i<b;i++){
cin>>arrB[i];
}
for(int i=0;i<a;i++){
if(arrA[i]=="A"){
countA1+=1;
}
}
for(int i=0;i<b;i++){
if(arrB[i]=="A"){
countA2+=1;
}
}
for(int j=0;j<a;j++){
for(int i=0;i<14;i++){
if(arrA[j]==card[i]){
sumA+=point[i];
while(countA1>0&&sumA>21){
sumA=sumA-10;
countA1--;
}
break;
}
}
}
for(int j=0;j<b;j++){
for(int i=0;i<14;i++){
if(arrB[j]==card[i]){
sumB+=point[i];
while(countA2>0&&sumB>21){
sumA=sumA-10;
countA2--;
}
break;
}
}
}
int sumA1=sumA;
int sumB1=sumB;
if(sumA>21){
sumA1=0;
}
if(sumB>21){
sumB1=0;
}
if(sumA1>sumB1){
cout<<"A"<<endl;
}
else if(sumA1<sumB1){
cout<<"B"<<endl;
}else if(sumA==sumB||(sumB>21&&sumB>21)){
cout<<"Draw"<<endl;
}
cout<<sumA<<" "<<sumB;
return 0;
} | # 2016025, 2024-09-28 11:05:15, PPPP-PPPPP-P--PPP--- (65%)
#include<bits//stdc++.h>
using namespace std;
int main(){
int a,b,point[14]={11,2,3,4,5,6,7,8,9,10,10,10,10,11},sumA=0,sumB=0,countA1=0,countA2;
cin>>a>>b;
string arrA[a],arrB[b],card[14]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
cin>>arrA[i];
}
for(int i=0;i<b;i++){
cin>>arrB[i];
}
for(int i=0;i<a;i++){
if(arrA[i]=="A"){
countA1+=1;
}
}
for(int i=0;i<b;i++){
if(arrB[i]=="A"){
countA2+=1;
}
}
for(int j=0;j<a;j++){
for(int i=0;i<14;i++){
if(arrA[j]==card[i]){
sumA+=point[i];
while(countA1>0&&sumA>21){
sumA=sumA-10;
countA1--;
}
break;
}
}
}
for(int j=0;j<b;j++){
for(int i=0;i<14;i++){
if(arrB[j]==card[i]){
sumB+=point[i];
while(countA2>0&&sumB>21){
sumB=sumB-10;
countA2--;
}
break;
}
}
}
int sumA1=sumA;
int sumB1=sumB;
if(sumA>21){
sumA1=0;
}
if(sumB>21){
sumB1=0;
}
if(sumA1>sumB1){
cout<<"A"<<endl;
}
else if(sumA1<sumB1){
cout<<"B"<<endl;
}else if(sumA==sumB||(sumB>21&&sumB>21)){
cout<<"Draw"<<endl;
}
cout<<sumA<<" "<<sumB;
return 0;
} |
# 2015295, 2024-09-28 09:52:44, PP------PPP----P--PP (40%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int na,nb;int totala=0;int totalb=0;
string card[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin>>na>>nb;
string keepa[na];
string keepb[nb];
for(int i=0;i<na;i++){
cin>>keepa[i];
}
for(int i=0;i<nb;i++){
cin>>keepb[i];
}
bool isa=false;
bool isb=false;
for(int i=0;i<na;i++){
for(int j=0;j<13;j++){
if(keepa[i]==card[j]){
totala+=value[j];
}
if(keepa[i]=="A"){
isa=true;
}
}
}
for(int i=0;i<nb;i++){
for(int j=0;j<13;j++){
if(keepb[i]==card[j]){
totalb+=value[j];
}
if(keepb[i]=="A"){
isb=true;
}
}
}
if(isa){
if(totala+10<=21){
totala+=10;
}
}
if(isb){
if(totalb+10<=21){
totalb+=10;
}
}
if(totala>totalb){
cout<<"A"<<endl;
cout<<totala<<" "<<totalb;
}
if(totalb>totala){
cout<<"B"<<endl;
cout<<totala<<" "<<totalb;
}
if(totala==totalb){
cout<<"draw"<<endl;
cout<<totala<<" "<<totala;
}
} | # 2015310, 2024-09-28 09:53:34, PPPPP---PPP--PPPP-PP (70%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int na,nb;int totala=0;int totalb=0;
string card[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin>>na>>nb;
string keepa[na];
string keepb[nb];
for(int i=0;i<na;i++){
cin>>keepa[i];
}
for(int i=0;i<nb;i++){
cin>>keepb[i];
}
bool isa=false;
bool isb=false;
for(int i=0;i<na;i++){
for(int j=0;j<13;j++){
if(keepa[i]==card[j]){
totala+=value[j];
}
if(keepa[i]=="A"){
isa=true;
}
}
}
for(int i=0;i<nb;i++){
for(int j=0;j<13;j++){
if(keepb[i]==card[j]){
totalb+=value[j];
}
if(keepb[i]=="A"){
isb=true;
}
}
}
if(isa){
if(totala+10<=21){
totala+=10;
}
}
if(isb){
if(totalb+10<=21){
totalb+=10;
}
}
if(totala>totalb){
cout<<"A"<<endl;
cout<<totala<<" "<<totalb;
}
if(totalb>totala){
cout<<"B"<<endl;
cout<<totala<<" "<<totalb;
}
if(totala==totalb){
cout<<"Draw"<<endl;
cout<<totala<<" "<<totala;
}
} | # 2016773, 2024-09-28 11:59:03, P-PPP----PP--PPPP--P (55%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int na,nb;int totala=0;int totalb=0;
string card[13]={"A","2","3","4","5","6","7","8","9","J","Q","K"};
int value[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin>>na>>nb;
string keepa[na];
string keepb[nb];
for(int i=0;i<na;i++){
cin>>keepa[i];
}
for(int i=0;i<nb;i++){
cin>>keepb[i];
}
bool isa=false;
bool isb=false;
for(int i=0;i<na;i++){
for(int j=0;j<13;j++){
if(keepa[i]==card[j]){
totala+=value[j];
}
if(keepa[i]=="A"){
isa=true;
}
}
}
for(int i=0;i<nb;i++){
for(int j=0;j<13;j++){
if(keepb[i]==card[j]){
totalb+=value[j];
}
if(keepb[i]=="A"){
isb=true;
}
}
}
if(isa){
if(totala+10<=21){
totala+=10;
}
}
if(isb){
if(totalb+10<=21){
totalb+=10;
}
}
if(totala>totalb){
cout<<"A"<<endl;
cout<<totala<<" "<<totalb;
}
if(totalb>totala){
cout<<"B"<<endl;
cout<<totala<<" "<<totalb;
}
if(totala==totalb){
cout<<"Draw"<<endl;
cout<<totala<<" "<<totala;
}
} | # 2016808, 2024-09-28 11:59:56, P-PPP----PP--PPPP--P (55%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int na,nb;int totala=0;int totalb=0;
string card[13]={"A","2","3","4","5","6","7","8","9","J","Q","K"};
int value[13]={1,2,3,4,5,6,7,8,9,10,10,10};
cin>>na>>nb;
string keepa[na];
string keepb[nb];
for(int i=0;i<na;i++){
cin>>keepa[i];
}
for(int i=0;i<nb;i++){
cin>>keepb[i];
}
bool isa=false;
bool isb=false;
for(int i=0;i<na;i++){
for(int j=0;j<13;j++){
if(keepa[i]==card[j]){
totala+=value[j];
}
if(keepa[i]=="A"){
isa=true;
}
}
}
for(int i=0;i<nb;i++){
for(int j=0;j<13;j++){
if(keepb[i]==card[j]){
totalb+=value[j];
}
if(keepb[i]=="A"){
isb=true;
}
}
}
if(isa){
if(totala+10<=21){
totala+=10;
}
}
if(isb){
if(totalb+10<=21){
totalb+=10;
}
}
if(totala>totalb){
cout<<"A"<<endl;
cout<<totala<<" "<<totalb;
}
if(totalb>totala){
cout<<"B"<<endl;
cout<<totala<<" "<<totalb;
}
if(totala==totalb){
cout<<"Draw"<<endl;
cout<<totala<<" "<<totala;
}
} |
# 2015289, 2024-09-28 09:52:26, --PPP--------PP-P--- (30%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0,checka=0,checkb=0;
string ca,cb;
vector<string> A,B;
cin>>a>>b;
for(int i=0;i<a;i++){
cin>>ca;
A.push_back(ca);
if(A[i]=="2"){
suma+=2;
}
if(A[i]=="3"){
suma+=3;
}
if(A[i]=="4"){
suma+=4;
}
if(A[i]=="5"){
suma+=5;
}
if(A[i]=="6"){
suma+=6;
}
if(A[i]=="7"){
suma+=7;
}
if(A[i]=="8"){
suma+=8;
}
if(A[i]=="9"){
suma+=9;
}
if(A[i]=="10"){
suma+=10;
}
if(A[i]=="J"){
suma+=10;
}
if(A[i]=="Q"){
suma+=10;
}
if(A[i]=="K"){
suma+=10;
}
if(A[i]=="A"){
checka++;
}
}
for(int z=0;z<b;z++){
cin>>cb;
B.push_back(cb);
if(B[z]=="2"){
sumb+=2;
}
if(B[z]=="3"){
sumb+=3;
}
if(B[z]=="4"){
sumb+=4;
}
if(B[z]=="5"){
sumb+=5;
}
if(B[z]=="6"){
sumb+=6;
}
if(B[z]=="7"){
sumb+=7;
}
if(B[z]=="8"){
sumb+=8;
}
if(B[z]=="9"){
sumb+=9;
}
if(B[z]=="10"){
sumb+=10;
}
if(B[z]=="J"){
sumb+=10;
}
if(B[z]=="Q"){
sumb+=10;
}
if(B[z]=="K"){
sumb+=10;
}
if(B[z]=="A"){
checkb++;
}
}
if(checka==1){
if(suma>11){
suma+=1;
}
else{
suma+=11;
}
}
if(checka==2){
if(suma>9){
suma+=2;
}
else{
suma+=12;
}
}
if(checka==3){
suma=13;
}
if(checkb==1){
if(sumb>11){
sumb+=1;
}
else{
sumb+=11;
}
}
if(checkb==2){
if(sumb>9){
sumb+=2;
}
else{
sumb+=12;
}
}
if(checkb==3){
sumb=13;
}
if(suma>sumb){
cout<<a<<endl;
cout<<suma<<" "<<sumb;
}
if(suma<sumb){
cout<<b<<endl;
cout<<suma<<" "<<sumb;
}
if(suma==sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2015313, 2024-09-28 09:53:51, PPPPP---PPP--PPPP-PP (70%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0,checka=0,checkb=0;
string ca,cb;
vector<string> A,B;
cin>>a>>b;
for(int i=0;i<a;i++){
cin>>ca;
A.push_back(ca);
if(A[i]=="2"){
suma+=2;
}
if(A[i]=="3"){
suma+=3;
}
if(A[i]=="4"){
suma+=4;
}
if(A[i]=="5"){
suma+=5;
}
if(A[i]=="6"){
suma+=6;
}
if(A[i]=="7"){
suma+=7;
}
if(A[i]=="8"){
suma+=8;
}
if(A[i]=="9"){
suma+=9;
}
if(A[i]=="10"){
suma+=10;
}
if(A[i]=="J"){
suma+=10;
}
if(A[i]=="Q"){
suma+=10;
}
if(A[i]=="K"){
suma+=10;
}
if(A[i]=="A"){
checka++;
}
}
for(int z=0;z<b;z++){
cin>>cb;
B.push_back(cb);
if(B[z]=="2"){
sumb+=2;
}
if(B[z]=="3"){
sumb+=3;
}
if(B[z]=="4"){
sumb+=4;
}
if(B[z]=="5"){
sumb+=5;
}
if(B[z]=="6"){
sumb+=6;
}
if(B[z]=="7"){
sumb+=7;
}
if(B[z]=="8"){
sumb+=8;
}
if(B[z]=="9"){
sumb+=9;
}
if(B[z]=="10"){
sumb+=10;
}
if(B[z]=="J"){
sumb+=10;
}
if(B[z]=="Q"){
sumb+=10;
}
if(B[z]=="K"){
sumb+=10;
}
if(B[z]=="A"){
checkb++;
}
}
if(checka==1){
if(suma>11){
suma+=1;
}
else{
suma+=11;
}
}
if(checka==2){
if(suma>9){
suma+=2;
}
else{
suma+=12;
}
}
if(checka==3){
suma=13;
}
if(checkb==1){
if(sumb>11){
sumb+=1;
}
else{
sumb+=11;
}
}
if(checkb==2){
if(sumb>9){
sumb+=2;
}
else{
sumb+=12;
}
}
if(checkb==3){
sumb=13;
}
if(suma>sumb){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}
if(suma<sumb){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}
if(suma==sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2016280, 2024-09-28 11:30:50, PPPPP-----P--PPPP--P (55%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0,checka=0,checkb=0;
string ca,cb;
vector<string> A,B;
cin>>a>>b;
for(int i=0;i<a;i++){
cin>>ca;
A.push_back(ca);
if(A[i]=="2"){
suma+=2;
}
if(A[i]=="3"){
suma+=3;
}
if(A[i]=="4"){
suma+=4;
}
if(A[i]=="5"){
suma+=5;
}
if(A[i]=="6"){
suma+=6;
}
if(A[i]=="7"){
suma+=7;
}
if(A[i]=="8"){
suma+=8;
}
if(A[i]=="9"){
suma+=9;
}
if(A[i]=="10"){
suma+=10;
}
if(A[i]=="J"){
suma+=10;
}
if(A[i]=="Q"){
suma+=10;
}
if(A[i]=="K"){
suma+=10;
}
if(A[i]=="A"){
checka++;
}
}
for(int z=0;z<b;z++){
cin>>cb;
B.push_back(cb);
if(B[z]=="2"){
sumb+=2;
}
if(B[z]=="3"){
sumb+=3;
}
if(B[z]=="4"){
sumb+=4;
}
if(B[z]=="5"){
sumb+=5;
}
if(B[z]=="6"){
sumb+=6;
}
if(B[z]=="7"){
sumb+=7;
}
if(B[z]=="8"){
sumb+=8;
}
if(B[z]=="9"){
sumb+=9;
}
if(B[z]=="10"){
sumb+=10;
}
if(B[z]=="J"){
sumb+=10;
}
if(B[z]=="Q"){
sumb+=10;
}
if(B[z]=="K"){
sumb+=10;
}
if(B[z]=="A"){
checkb++;
}
}
if(checka==1){
if(suma>2){
suma+=1;
}
else{
suma+=11;
}
}
if(checka==2){
if(suma>9){
suma+=2;
}
else{
suma+=12;
}
}
if(checka==3){
suma=13;
}
if(checkb==1){
if(sumb>2){
sumb+=1;
}
else{
sumb+=11;
}
}
if(checkb==2){
if(sumb>9){
sumb+=2;
}
else{
sumb+=12;
}
}
if(checkb==3){
sumb=13;
}
if(suma>sumb){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}
if(suma<sumb){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}
if(suma==sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2016281, 2024-09-28 11:31:05, PPPPP-----P--PPPP--P (55%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0,checka=0,checkb=0;
string ca,cb;
vector<string> A,B;
cin>>a>>b;
for(int i=0;i<a;i++){
cin>>ca;
A.push_back(ca);
if(A[i]=="2"){
suma+=2;
}
if(A[i]=="3"){
suma+=3;
}
if(A[i]=="4"){
suma+=4;
}
if(A[i]=="5"){
suma+=5;
}
if(A[i]=="6"){
suma+=6;
}
if(A[i]=="7"){
suma+=7;
}
if(A[i]=="8"){
suma+=8;
}
if(A[i]=="9"){
suma+=9;
}
if(A[i]=="10"){
suma+=10;
}
if(A[i]=="J"){
suma+=10;
}
if(A[i]=="Q"){
suma+=10;
}
if(A[i]=="K"){
suma+=10;
}
if(A[i]=="A"){
checka++;
}
}
for(int z=0;z<b;z++){
cin>>cb;
B.push_back(cb);
if(B[z]=="2"){
sumb+=2;
}
if(B[z]=="3"){
sumb+=3;
}
if(B[z]=="4"){
sumb+=4;
}
if(B[z]=="5"){
sumb+=5;
}
if(B[z]=="6"){
sumb+=6;
}
if(B[z]=="7"){
sumb+=7;
}
if(B[z]=="8"){
sumb+=8;
}
if(B[z]=="9"){
sumb+=9;
}
if(B[z]=="10"){
sumb+=10;
}
if(B[z]=="J"){
sumb+=10;
}
if(B[z]=="Q"){
sumb+=10;
}
if(B[z]=="K"){
sumb+=10;
}
if(B[z]=="A"){
checkb++;
}
}
if(checka==1){
if(suma>2){
suma+=1;
}
else{
suma+=11;
}
}
if(checka==2){
if(suma>9){
suma+=2;
}
else{
suma+=12;
}
}
if(checka==3){
suma=13;
}
if(checkb==1){
if(sumb>2){
sumb+=1;
}
else{
sumb+=11;
}
}
if(checkb==2){
if(sumb>9){
sumb+=2;
}
else{
sumb+=12;
}
}
if(checkb==3){
sumb=13;
}
if(suma>sumb){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}
if(suma<sumb){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}
if(suma==sumb){
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} |
# 2015595, 2024-09-28 10:22:10, PPPPPPPPP---P-P--PP- (65%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
for (int i = 0; i < ca.length(); i++){
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
sum_a = sum_a + 11;
if(sum_a > 21){
sum_a = sum_a - 10;
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
sum_b = sum_b + 11;
if(sum_b > 21){
sum_b = sum_b - 10;
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} | # 2015796, 2024-09-28 10:44:01, PPPPPPPPP----------- (45%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
for (int i = 0; i < ca.length(); i++){
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
sum_a = sum_a + 11;
if(sum_a > 21){
sum_a = sum_a + 1;
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
if(sum_b > 21 || sum_b == 11 || sum_b == 0){
sum_b = sum_b + 1 ;
}
else{
sum_b = sum_b + 11;
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} | # 2015803, 2024-09-28 10:44:35, PPPPPPPP------------ (40%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
for (int i = 0; i < ca.length(); i++){
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
if(sum_b > 21 || sum_b == 11 || sum_b == 0){
sum_b = sum_b + 1 ;
}
else{
sum_b = sum_b + 11;
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
if(sum_b > 21 || sum_b == 11 || sum_b == 0){
sum_b = sum_b + 1 ;
}
else{
sum_b = sum_b + 11;
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} | # 2015813, 2024-09-28 10:45:08, PPPPPPPPP----------- (45%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
for (int i = 0; i < ca.length(); i++){
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
sum_a = sum_a + 11;
if(sum_a > 21){
sum_a = sum_a + 1;
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
sum_b = sum_b + 11;
if(sum_b > 21){
sum_b = sum_b + 1;
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} | # 2015818, 2024-09-28 10:45:53, PPPPPPPPP---P-P--PP- (65%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
for (int i = 0; i < ca.length(); i++){
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
sum_a = sum_a + 11;
if(sum_a > 21){
sum_a = sum_a - 10;
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
sum_b = sum_b + 11;
if(sum_b > 21){
sum_b = sum_b - 10;
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} | # 2016231, 2024-09-28 11:26:03, PPPPPPPPP---P-P--PP- (65%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
bool have_Aofa = false;
int count = 0;
for (int i = 0; i < ca.length(); i++){
int e = ca[i];
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
sum_a = sum_a + 11;
if(sum_a > 21){
sum_a = sum_a - 10 ;
if(sum_a > 21){
for (int j = 0; j < i; j++){
if(ca[j] == 'A'){
sum_a = sum_a - 10;
}
}
}
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
sum_b = sum_b + 11;
if(sum_b > 21){
sum_b = sum_b - 10 ;
if(sum_b > 21){
for (int j = 0; j < i; j++){
if(cb[j] == 'A'){
sum_b = sum_b - 10;
}
}
}
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} | # 2016254, 2024-09-28 11:29:00, T-----T-T---T-T---T- (0%)
#include <iostream>
using namespace std;
int main() {
long long int n;
cin >> n;
int d = 2;
if(n < 2){
cout << "No prime factors for number less than 2.";
}
else{
while (n > 1){
if(d * d > n){
if(n % 2 != 0){
cout << n;
break;
}
}
else{
if (n % d == 0){
n /= d;
while (n >= d){
if(n % d == 0){
n /= d;
cout << d << " ";
}
else{
d++;
}
}
return 0;
}
else{
d += 1;
continue;
}
}
}
return 0;
}
} | # 2016258, 2024-09-28 11:29:27, -------------------- (0%)
#include <iostream>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int d = 2;
if(n < 2){
cout << "No prime factors for number less than 2.";
}
else{
while (n > 1){
if(d * d > n){
cout << n;
break;
}
else{
if (n % d == 0){
n /= d;
while (n >= d){
if(n % d == 0){
n /= d;
cout << d << " ";
}
else{
d++;
}
}
return 0;
}
else{
d += 1;
continue;
}
}
}
return 0;
}
} | # 2016263, 2024-09-28 11:29:52, PPPPPPPPP---P-P--PP- (65%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string ca;
getline(cin >> ws, ca);
string cb;
getline(cin >> ws, cb);
int sum_a = 0;
int sum_b = 0;
bool have_Aofa = false;
int count = 0;
for (int i = 0; i < ca.length(); i++){
int e = ca[i];
if(ca[i] >= '2' && ca[i] <= '9'){
sum_a = sum_a + ca[i] - '0';
}
else if (ca[i] == 'J' || ca[i] =='K' || ca[i] == 'Q'){
sum_a = sum_a + 10;
}
else if (ca[i] == 'A'){
sum_a = sum_a + 11;
if(sum_a > 21){
sum_a = sum_a - 10 ;
if(sum_a > 21){
for (int j = 0; j < i; j++){
if(ca[j] == 'A'){
sum_a = sum_a - 10;
}
}
}
}
}
else if(ca[i] == '1'){
sum_a = sum_a + 10;
}
else{
sum_a = sum_a + 0;
}
}
for (int i = 0; i < cb.length(); i++){
if(cb[i] >= '2' && cb[i] <= '9'){
sum_b = sum_b + cb[i] - '0';
}
else if (cb[i] == 'J' || cb[i] =='K' || cb[i] == 'Q'){
sum_b = sum_b + 10;
}
else if (cb[i] == 'A'){
sum_b = sum_b + 11;
if(sum_b > 21){
sum_b = sum_b - 10 ;
if(sum_b > 21){
for (int j = 0; j < i; j++){
if(cb[j] == 'A'){
sum_b = sum_b - 10;
}
}
}
}
}
else if(cb[i] == '1'){
sum_b = sum_b + 10;
}
else{
sum_b = sum_b + 0;
}
}
if(sum_a <= 21 && sum_b <= 21){
if(sum_a > sum_b){
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a < sum_b) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else{
cout << "Draw" << endl << sum_a << " " << sum_b;
}
}
else if(sum_a <= 21 && sum_b > 21) {
cout << "A" << endl << sum_a << " " << sum_b;
}
else if(sum_a > 21 && sum_b <= 21) {
cout << "B" << endl << sum_a << " " << sum_b;
}
else if (sum_a > 21 && sum_b > 21){
cout << "Draw" << endl << sum_a << " " << sum_b;
}
} |
# 2015369, 2024-09-28 09:59:11, ----P--------------- (5%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] ='K'){
sumA+=10;
} else if(Card[0]='Q'){
sumA +=10;
} else if(Card[0]='J'){
sumA +=10;
} else if(Card[0]='1'){
sumA +=10;
}else if(Card[0]='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card[0]='K'){
sumB+=10;
} else if(Card2[0]='Q'){
sumB +=10;
} else if(Card2[0]='J'){
sumB +=10;
}else if(Card[0]='1'){
sumA +=10;
} else if(Card2[0]='A'){
sumB +=11;
findB++;
} else{
sumA += (Card[0]-'0');
}
}
if(sumA>21){
sumA -= findA*10;
}
if(sumB>21){
sumB -= findB*10;
}
if(sumA > sumB){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
cout << sumA << " " << sumB<<endl;
} | # 2015470, 2024-09-28 10:09:52, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
cout << sumA << endl;
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=11;
findB++;
} else{
sumA += (Card[0]-'0');
}
cout << sumB << endl;
}
if(sumA>21){
sumA -= findA*10;
}
if(sumB>21){
sumB -= findB*10;
}
if(sumA > sumB){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
cout << sumA << " " << sumB<<endl;
} | # 2015480, 2024-09-28 10:10:41, ----P-----P--------- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=11;
findB++;
} else{
sumA += (Card[0]-'0');
}
}
if(sumA>21){
sumA -= findA*10;
}
if(sumB>21){
sumB -= findB*10;
}
if(sumA > sumB){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
cout << sumA << " " << sumB<<endl;
} | # 2015524, 2024-09-28 10:14:52, ----P--------------- (5%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=11;
findB++;
} else{
sumA += (Card[0]-'0');
}
}
bool BlowA=false ,BlowB=false;
if(sumA>21){
sumA -= findA*10;
if(sumA > 21){
BlowA=true;
}
}
if(sumB>21){
sumB -= findB*10;
BlowB=true;
}
if(sumA > sumB && (!BlowA||BlowB)){
cout <<"A"<<endl;
}else if(sumB > sumA && (!BlowB||BlowA)){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
cout << sumA << " " << sumB<<endl;
} | # 2015565, 2024-09-28 10:18:33, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=11;
findB++;
} else{
sumA += (Card[0]-'0');
}
}
bool BlowA=false ,BlowB=false;
if(sumA>21){
sumA -= findA*10;
if(sumA > 21){
BlowA=true;
}
}
if(sumB>21){
sumB -= findB*10;
BlowB=true;
}
if(BlowA && BlowB){
cout << "Draw";
}else if(BlowA && !BlowB){
cout <<"B";
}else if(!BlowA && BlowB){
cout <<"A";
}else {
if(sumA > sumB ){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
}
cout << sumA << " " << sumB<<endl;
} | # 2015572, 2024-09-28 10:19:15, ----P------P-------- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=11;
findB++;
} else{
sumA += (Card[0]-'0');
}
}
bool BlowA=false ,BlowB=false;
if(sumA>21){
sumA -= findA*10;
if(sumA > 21){
BlowA=true;
}
}
if(sumB>21){
sumB -= findB*10;
BlowB=true;
}
if(BlowA && BlowB){
cout << "Draw"<<endl;
}else if(BlowA && !BlowB){
cout <<"B"<<endl;
}else if(!BlowA && BlowB){
cout <<"A"<<endl;
}else {
if(sumA > sumB ){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
}
cout << sumA << " " << sumB<<endl;
} | # 2015592, 2024-09-28 10:21:49, P-PPP-P----P-------- (30%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=11;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=11;
findB++;
} else{
sumB += (Card2[0]-'0');
}
}
bool BlowA=false ,BlowB=false;
if(sumA>21){
sumA -= findA*10;
if(sumA > 21){
BlowA=true;
}
}
if(sumB>21){
sumB -= findB*10;
BlowB=true;
}
if(BlowA && BlowB){
cout << "Draw"<<endl;
}else if(BlowA && !BlowB){
cout <<"B"<<endl;
}else if(!BlowA && BlowB){
cout <<"A"<<endl;
}else {
if(sumA > sumB ){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
}
cout << sumA << " " << sumB<<endl;
} | # 2015666, 2024-09-28 10:30:04, P-PPP-P---PPPPPPPP-- (65%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=1;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=1;
findB++;
} else{
sumB += (Card2[0]-'0');
}
}
for(int j=findA;j > 0 ;j--){
if(sumA<21){
sumA+=10;
}
if(sumA>21){
sumA-=10;
}
}
for(int j=findB;j > 0 ;j--){
if(sumB<21){
sumB+=10;
}
if(sumB > 21){
sumB-=10;
}
}
bool BlowA=false ,BlowB=false;
if(sumA > 21){
BlowA=true;
}
if(sumB>21){
BlowB=true;
}
if(BlowA && BlowB){
cout << "Draw"<<endl;
}else if(BlowA && !BlowB){
cout <<"B"<<endl;
}else if(!BlowA && BlowB){
cout <<"A"<<endl;
}else {
if(sumA > sumB ){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
}
cout << sumA << " " << sumB<<endl;
} | # 2016534, 2024-09-28 11:48:25, P-PPP-P---PPPPPPPP-- (65%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int C1,C2;
cin >> C1>>C2;
char Card[2],Card2[2];
int sumA=0,sumB=0;
int findA=0,findB=0;
for (int i = 0;i<C1;i++) {
cin >> Card;
if (Card[0] =='K'){
sumA+=10;
} else if(Card[0] =='Q'){
sumA +=10;
} else if(Card[0] =='J'){
sumA +=10;
} else if(Card[1] =='0'){
sumA +=10;
}else if(Card[0] =='A'){
sumA +=1;
findA++;
} else{
sumA += (Card[0]-'0');
}
}
for (int i = 0;i<C2;i++) {
cin >> Card2;
if (Card2[0] =='K'){
sumB+=10;
} else if(Card2[0] =='Q'){
sumB +=10;
} else if(Card2[0] =='J'){
sumB +=10;
}else if(Card2[0] =='1'){
sumB +=10;
} else if(Card2[0] =='A'){
sumB +=1;
findB++;
} else{
sumB += (Card2[0]-'0');
}
}
for(int j=findA;j > 0 ;j--){
if(sumA<21){
sumA+=10;
}
if(sumA>21){
sumA-=10;
}
}
for(int j=findB;j > 0 ;j--){
if(sumB<21){
sumB+=10;
}
if(sumB > 21){
sumB-=10;
}
}
bool BlowA=false ,BlowB=false;
if(sumA > 21){
BlowA=true;
}
if(sumB>21){
BlowB=true;
}
if(BlowA && BlowB){
cout << "Draw"<<endl;
}else if(BlowA && !BlowB){
cout <<"B"<<endl;
}else if(!BlowA && BlowB){
cout <<"A"<<endl;
}else {
if(sumA > sumB ){
cout <<"A"<<endl;
}else if(sumB > sumA){
cout << "B"<<endl;
}else {
cout << "Draw"<<endl;
}
}
cout << sumA << " " << sumB<<endl;
} |
# 2015540, 2024-09-28 10:16:01, -------------------- (0%)
#include <iostream>
using namespace std;
int main()
{
int na, nb;
cin >> na >> nb;
// cout << na << " " << nb << endl;
string a, b;
cin.ignore();
getline(cin, a);
getline(cin, b);
cout << endl
<< "Output" << endl;
cout << a << endl
<< b << endl
<< "===========" << endl;
int point_a = 0;
int point_b = 0;
for (size_t i = 0; i < a.length(); i++)
{
if (isspace(a[i]))
continue;
if ((char)a[i] == 'A')
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
else if ((char)a[i] == 'J' || (char)a[i] == 'Q' || (char)a[i] == 'K')
{
point_a += 10;
}
else
{
if ((char)a[i] == '2')
{
point_a += 2;
}
else if ((char)a[i] == '3')
{
point_a += 3;
}
else if ((char)a[i] == '4')
{
point_a += 4;
}
else if ((char)a[i] == '5')
{
point_a += 5;
}
else if ((char)a[i] == '6')
{
point_a += 6;
}
else if ((char)a[i] == '7')
{
point_a += 7;
}
else if ((char)a[i] == '8')
{
point_a += 8;
}
else if ((char)a[i] == '9')
{
point_a += 9;
}
}
}
for (size_t i = 0; i < b.length(); i++)
{
if (isspace(b[i]))
continue;
if ((char)b[i] == 'A')
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
else if ((char)b[i] == 'J' || (char)b[i] == 'Q' || (char)b[i] == 'K')
{
point_b += 10;
}
else
{
if ((char)b[i] == '2')
{
point_b += 2;
}
else if ((char)b[i] == '3')
{
point_b += 3;
}
else if ((char)b[i] == '4')
{
point_b += 4;
}
else if ((char)b[i] == '5')
{
point_b += 5;
}
else if ((char)b[i] == '6')
{
point_b += 6;
}
else if ((char)b[i] == '7')
{
point_b += 7;
}
else if ((char)b[i] == '8')
{
point_b += 8;
}
else if ((char)b[i] == '9')
{
point_b += 9;
}
}
}
if (point_a > point_b)
cout << "A" << endl;
else if (point_a < point_b)
cout << "B" << endl;
else
cout << "Draw" << endl;
cout << point_a << " " << point_b << endl;
} | # 2015640, 2024-09-28 10:27:09, P-PPP----P----P----P (35%)
#include <iostream>
using namespace std;
int main()
{
int na, nb;
cin >> na >> nb;
string a, b;
cin.ignore();
getline(cin, a);
getline(cin, b);
int point_a = 0;
int point_b = 0;
for (size_t i = 0; i < a.length(); i++)
{
if (isspace(a[i]))
continue;
if ((char)a[i] == 'A')
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
else if ((char)a[i] == 'J' || (char)a[i] == 'Q' || (char)a[i] == 'K')
{
point_a += 10;
}
else
{
if ((char)a[i] == '2')
{
point_a += 2;
}
else if ((char)a[i] == '3')
{
point_a += 3;
}
else if ((char)a[i] == '4')
{
point_a += 4;
}
else if ((char)a[i] == '5')
{
point_a += 5;
}
else if ((char)a[i] == '6')
{
point_a += 6;
}
else if ((char)a[i] == '7')
{
point_a += 7;
}
else if ((char)a[i] == '8')
{
point_a += 8;
}
else if ((char)a[i] == '9')
{
point_a += 9;
}
}
}
for (size_t i = 0; i < b.length(); i++)
{
if (isspace(b[i]))
continue;
if ((char)b[i] == 'A')
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
else if ((char)b[i] == 'J' || (char)b[i] == 'Q' || (char)b[i] == 'K')
{
point_b += 10;
}
else
{
if ((char)b[i] == '2')
{
point_b += 2;
}
else if ((char)b[i] == '3')
{
point_b += 3;
}
else if ((char)b[i] == '4')
{
point_b += 4;
}
else if ((char)b[i] == '5')
{
point_b += 5;
}
else if ((char)b[i] == '6')
{
point_b += 6;
}
else if ((char)b[i] == '7')
{
point_b += 7;
}
else if ((char)b[i] == '8')
{
point_b += 8;
}
else if ((char)b[i] == '9')
{
point_b += 9;
}
else
{
point_b += 10;
}
}
}
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
cout << point_a << " " << point_b << endl;
} | # 2015644, 2024-09-28 10:27:39, P-PPP---------P----- (25%)
#include <iostream>
using namespace std;
int main()
{
int na, nb;
cin >> na >> nb;
string a, b;
cin.ignore();
getline(cin, a);
getline(cin, b);
int point_a = 0;
int point_b = 0;
for (size_t i = 0; i < a.length(); i++)
{
if (isspace(a[i]))
continue;
if ((char)a[i] == 'A')
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
else if ((char)a[i] == 'J' || (char)a[i] == 'Q' || (char)a[i] == 'K')
{
point_a += 10;
}
else
{
if ((char)a[i] == '2')
{
point_a += 2;
}
else if ((char)a[i] == '3')
{
point_a += 3;
}
else if ((char)a[i] == '4')
{
point_a += 4;
}
else if ((char)a[i] == '5')
{
point_a += 5;
}
else if ((char)a[i] == '6')
{
point_a += 6;
}
else if ((char)a[i] == '7')
{
point_a += 7;
}
else if ((char)a[i] == '8')
{
point_a += 8;
}
else if ((char)a[i] == '9')
{
point_a += 9;
}
else
{
point_b += 10;
}
}
}
for (size_t i = 0; i < b.length(); i++)
{
if (isspace(b[i]))
continue;
if ((char)b[i] == 'A')
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
else if ((char)b[i] == 'J' || (char)b[i] == 'Q' || (char)b[i] == 'K')
{
point_b += 10;
}
else
{
if ((char)b[i] == '2')
{
point_b += 2;
}
else if ((char)b[i] == '3')
{
point_b += 3;
}
else if ((char)b[i] == '4')
{
point_b += 4;
}
else if ((char)b[i] == '5')
{
point_b += 5;
}
else if ((char)b[i] == '6')
{
point_b += 6;
}
else if ((char)b[i] == '7')
{
point_b += 7;
}
else if ((char)b[i] == '8')
{
point_b += 8;
}
else if ((char)b[i] == '9')
{
point_b += 9;
}
else
{
point_b += 10;
}
}
}
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
cout << point_a << " " << point_b << endl;
} | # 2015842, 2024-09-28 10:48:37, PPPPP---P-----P---P- (40%)
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int na, nb, point_a = 0, point_b = 0;
cin >> na >> nb;
if (na == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
//////////////////////////////
if (nb == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
cout << point_a << " " << point_b << endl;
} | # 2015877, 2024-09-28 10:52:48, PPPP-PP-P---P-P--PP- (55%)
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int na, nb, point_a = 0, point_b = 0;
cin >> na >> nb;
if (na == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
//////////////////////////////
if (nb == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
if (point_a > 21)
{
cout << "B" << endl;
}
else if (point_b > 21)
{
cout << "A" << endl;
}
else
{
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
}
cout << point_a << " " << point_b << endl;
} | # 2016177, 2024-09-28 11:21:05, PPPP-PP-P---P-P--PP- (55%)
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int na, nb, point_a = 0, point_b = 0;
cin >> na >> nb;
if (na == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
//////////////////////////////
if (nb == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
if (point_a > 21)
{
cout << "B" << endl;
}
else if (point_b > 21)
{
cout << "A" << endl;
}
else
{
if (point_a > 21 && point_b > 21)
{
cout << "Draw" << endl;
}
else if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
}
cout << point_a << " " << point_b << endl;
} | # 2016183, 2024-09-28 11:21:57, PPPPPPPPP---P-P--PP- (65%)
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int na, nb, point_a = 0, point_b = 0;
cin >> na >> nb;
if (na == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_a += 1;
}
else if (n == "2")
{
point_a += 2;
}
else if (n == "3")
{
point_a += 3;
}
else if (n == "4")
{
point_a += 4;
}
else if (n == "5")
{
point_a += 5;
}
else if (n == "6")
{
point_a += 6;
}
else if (n == "7")
{
point_a += 7;
}
else if (n == "8")
{
point_a += 8;
}
else if (n == "9")
{
point_a += 9;
}
else if (n == "10")
{
point_a += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_a += 10;
}
else if (n == "A")
{
if (point_a + 11 > 21)
{
point_a += 1;
}
else
{
point_a += 11;
}
}
}
}
//////////////////////////////
if (nb == 3)
{
for (size_t i = 0; i < 3; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
else
{
for (size_t i = 0; i < 2; i++)
{
string n;
cin >> n;
if (n == "1")
{
point_b += 1;
}
else if (n == "2")
{
point_b += 2;
}
else if (n == "3")
{
point_b += 3;
}
else if (n == "4")
{
point_b += 4;
}
else if (n == "5")
{
point_b += 5;
}
else if (n == "6")
{
point_b += 6;
}
else if (n == "7")
{
point_b += 7;
}
else if (n == "8")
{
point_b += 8;
}
else if (n == "9")
{
point_b += 9;
}
else if (n == "10")
{
point_b += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point_b += 10;
}
else if (n == "A")
{
if (point_b + 11 > 21)
{
point_b += 1;
}
else
{
point_b += 11;
}
}
}
}
if (point_a > 21 && point_b > 21)
{
cout << "Draw" << endl;
}
else if (point_a > 21)
{
cout << "B" << endl;
}
else if (point_b > 21)
{
cout << "A" << endl;
}
else
{
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
}
cout << point_a << " " << point_b << endl;
} | # 2016465, 2024-09-28 11:43:26, PPPPPPPPP--------PPP (60%)
#include <iostream>
#include <vector>
using namespace std;
int cal(int m)
{
int point = 0, count_a = 0;
for (size_t i = 0; i < m; i++)
{
string n;
cin >> n;
if (n == "1")
{
point += 1;
}
else if (n == "2")
{
point += 2;
}
else if (n == "3")
{
point += 3;
}
else if (n == "4")
{
point += 4;
}
else if (n == "5")
{
point += 5;
}
else if (n == "6")
{
point += 6;
}
else if (n == "7")
{
point += 7;
}
else if (n == "8")
{
point += 8;
}
else if (n == "9")
{
point += 9;
}
else if (n == "10")
{
point += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point += 10;
}
else if (n == "A")
{
count_a++;
if (point + 11 > 21)
{
if(count_a > 1){
point = point - 10;
}
point += 1;
}
else
{
point += 11;
}
}
}
return point;
}
int main()
{
int na, nb, point_a = 0, point_b = 0;
cin >> na >> nb;
point_a = cal(na);
point_b = cal(nb);
if (point_a > 21 && point_b > 21)
{
cout << "Draw" << endl;
}
else if (point_a > 21)
{
cout << "B" << endl;
}
else if (point_b > 21)
{
cout << "A" << endl;
}
else
{
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
}
cout << point_a << " " << point_b << endl;
} | # 2016527, 2024-09-28 11:48:03, PPPPPPPPP--------PPP (60%)
#include <iostream>
#include <vector>
using namespace std;
int cal(int m)
{
int point = 0, count_a = 0;
for (size_t i = 0; i < m; i++)
{
string n;
cin >> n;
if (n == "1")
{
point += 1;
}
else if (n == "2")
{
point += 2;
}
else if (n == "3")
{
point += 3;
}
else if (n == "4")
{
point += 4;
}
else if (n == "5")
{
point += 5;
}
else if (n == "6")
{
point += 6;
}
else if (n == "7")
{
point += 7;
}
else if (n == "8")
{
point += 8;
}
else if (n == "9")
{
point += 9;
}
else if (n == "10")
{
point += 10;
}
else if (n == "J" || n == "Q" || n == "K")
{
point += 10;
}
else if (n == "A")
{
count_a++;
if (point + 11 > 21)
{
if (count_a > 1)
{
point = point - 9;
}
else
{
point += 1;
}
}
else
{
point += 11;
}
}
}
return point;
}
int main()
{
int na, nb, point_a = 0, point_b = 0;
cin >> na >> nb;
point_a = cal(na);
point_b = cal(nb);
if (point_a > 21 && point_b > 21)
{
cout << "Draw" << endl;
}
else if (point_a > 21)
{
cout << "B" << endl;
}
else if (point_b > 21)
{
cout << "A" << endl;
}
else
{
if (point_a > point_b)
{
cout << "A" << endl;
}
else if (point_a < point_b)
{
cout << "B" << endl;
}
else
{
cout << "Draw" << endl;
}
}
cout << point_a << " " << point_b << endl;
} |
# 2015218, 2024-09-28 09:45:40, PPPPP--PP----------- (35%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}
}
if(score<=21){
for(int i=0; i<s.size(); ++i){
if(s[i]=="A"){
score += 21 - score;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>score_b && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a && score_b <= 21){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2015243, 2024-09-28 09:48:19, PPPPPPPPP----------- (45%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}
}
if(score<=21){
for(int i=0; i<s.size(); ++i){
if(s[i]=="A"){
score += 21 - score;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2015294, 2024-09-28 09:52:37, PPPPPPPP------------ (40%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}
}
if(score<=21){
for(int i=0; i<s.size(); ++i){
if(s[i]=="A"){
int diff = 21 - score;
int g = diff -1;
int f = diff -11;
if(g<f){
score += 1;
}else if(f>g){
score += 11;
}
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2015645, 2024-09-28 10:27:42, PPPPPPPPP----------- (45%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}
}
if(score<=21){
for(int i=0; i<s.size(); ++i){
if(s[i]=="A"){
int diff = 21 - score;
int g = diff -1;
int f = diff -11;
// cout << "<21";
if(g<f){
score += 1;
}else if(f<g){
score += 11;
}
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2015804, 2024-09-28 10:44:37, PPPPPPPPP---P-P--PP- (65%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}else if(s[i]=="A"){
if(score+11>21){
score += 1;
}else{
score += 11;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2015820, 2024-09-28 10:46:04, PPPPPPPPP---P-P--PP- (65%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}else if(s[i]=="A"){
if(score+11>21){
if(score+1<=21){
score += 1;
}
}else{
score += 11;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2016273, 2024-09-28 11:30:26, PPPPPPPPP---P-P--PP- (65%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}else if(s[i]=="A"){
if(score+11>21){
// if(score+1<=21){
score += 1;
// }
}else{
score += 11;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2016570, 2024-09-28 11:50:24, PPPPPPPP----P-P--PP- (60%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}else if(s[i]=="A"){
if(score+11>=21){
// if(score+1<=21){
score += 1;
// }
}else{
score += 11;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
cout << endl;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else{
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} | # 2016673, 2024-09-28 11:55:23, PPPPPPPPP---P-P--PP- (65%)
#include<iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
bool is_digit(string s){
vector<string> d = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
for(int i=0; i<d.size(); ++i){
// cout << s << " " << d[i];
if(s==d[i]){
return true;
}
}
return false;
}
int cal_score(vector<string> s){
int score = 0;
for(int i=0; i<s.size(); ++i){
if(is_digit(s[i])){
score += stoi(s[i]);
}else if(s[i]=="J" || s[i]=="Q" || s[i]=="K"){
score += 10;
}else if(s[i]=="A"){
if(score+11>21){
// if(score+1<=21){
score += 1;
// }
}else{
score += 11;
}
}
}
return score;
}
int main(){
int an;
int bn;
cin >> an >> bn;
vector<string> av;
vector<string> bv;
for(int i=0; i < an; ++i){
string c;
cin >> c;
av.push_back(c);
}
int score_a = cal_score(av);
for(int i=0; i < bn; ++i){
string c;
cin >> c;
bv.push_back(c);
}
int score_b = cal_score(bv);
if(score_a>21 && score_b <=21){
cout << "B" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_b>21 && score_a <= 21){
cout << "A" << endl;
cout << score_a << " " << score_b;
return 0;
}else if(score_a >21 && score_b > 21){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
return 0;
}
if(score_a>score_b ){
cout << "A" << endl;
cout << score_a << " " << score_b;
}else if (score_b >score_a){
cout << "B" << endl;
cout << score_a << " " << score_b;
}else if (score_b == score_a){
cout << "Draw" << endl;
cout << score_a << " " << score_b;
}
} |
# 2015329, 2024-09-28 09:56:01, -------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw";
}else if(totalA > totalB){
cout << A << endl;
cout << totalA << totalB << endl;
}
} | # 2015372, 2024-09-28 09:59:28, Compilation error (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << A << endl;
cout << totalA << " " << totalB << endl;
}else{totalB > totalA}{
cout << B << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015374, 2024-09-28 10:00:04, Compilation error (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << A << endl;
cout << totalA << " " << totalB << endl;
}else(totalB > totalA){
cout << B << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015375, 2024-09-28 10:00:09, Compilation error (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << A << endl;
cout << totalA << " " << totalB << endl;
}else(totalB > totalA){
cout << B << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015380, 2024-09-28 10:00:41, -------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << A << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << B << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015412, 2024-09-28 10:02:42, -------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
}
}
for(int i=0; i<b; ++i){
if(A[i]==front[i]){
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << A << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << B << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015447, 2024-09-28 10:07:05, -------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
for(int i=0; i<a; ++i){
cin >> A[i];
}
for(int i=0; i<b; ++i){
cin >> B[i];
}
string front[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[13]={ 1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
if(A[i]==front[i]){
totalA += value[i];
}
}
for(int i=0; i<b; ++i){
if(B[i]==front[i]){
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015718, 2024-09-28 10:34:12, -------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[]={1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
if(A[i]==front[i]){
totalA += value[i];
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
if(B[i]==front[i]){
totalB += value[i];
}
}
if((totalA > 21) && (totalB > 21)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015853, 2024-09-28 10:50:37, -------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int value[]={1,2,3,4,5,6,7,8,9,10,10,10,10};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
if(A[i]==front[i]){
totalA += value[i];
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
if(B[i]==front[i]){
totalB += value[i];
}
}
if(((totalA > 21) && (totalB > 21)) || (totalA == totalB)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2015952, 2024-09-28 10:58:58, PPPPP--P--P--------- (35%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
string value[]={"1","2","3","4","5","6","7","8","9","10","10","10","10"};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
for(int j=0; j<13; ++j){
if(A[i]==front[j]){
totalA += stoi(value[j]);
}
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
for(int j=0; j<13; ++j){
if(B[i]==front[j]){
totalB += stoi(value[j]);
}
}
}
if(((totalA > 21) && (totalB > 21)) || (totalA == totalB)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2016033, 2024-09-28 11:06:02, PPPPP--PP----------- (35%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
string value[]={"11","2","3","4","5","6","7","8","9","10","10","10","10"};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
for(int j=0; j<13; ++j){
if(A[i]==front[j]){
totalA += stoi(value[j]);
if((totalA > 21)&&(A[i] == front[0])){
value[0] = "1";
}
}
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
for(int j=0; j<13; ++j){
if(B[i]==front[j]){
totalB += stoi(value[j]);
if((totalB > 21)&&(B[i] == front[0])){
value[0] = "1";
}
}
}
}
if(((totalA > 21) && (totalB > 21)) || (totalA == totalB)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2016087, 2024-09-28 11:12:03, PPPP----P----------- (25%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
string value[]={"11","2","3","4","5","6","7","8","9","10","10","10","10"};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
for(int j=0; j<13; ++j){
if(A[i]==front[j]){
totalA += stoi(value[j]);
if(totalA > 21){
value[0] = "1";
totalA += stoi(value[j]);
}
}
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
for(int j=0; j<13; ++j){
if(B[i]==front[j]){
totalB += stoi(value[j]);
if(totalB > 21){
value[0] = "1";
totalB += stoi(value[j]);
}
}
}
}
if(((totalA > 21) && (totalB > 21)) || (totalA == totalB)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2016089, 2024-09-28 11:12:25, PPPPP--PP----------- (35%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
string value[]={"11","2","3","4","5","6","7","8","9","10","10","10","10"};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
for(int j=0; j<13; ++j){
if(A[i]==front[j]){
totalA += stoi(value[j]);
if((totalA > 21)&&(A[i] == front[0])){
value[0] = "1";
}
}
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
for(int j=0; j<13; ++j){
if(B[i]==front[j]){
totalB += stoi(value[j]);
if((totalB > 21)&&(B[i] == front[0])){
value[0] = "1";
}
}
}
}
if(((totalA > 21) && (totalB > 21)) || (totalA == totalB)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} | # 2016414, 2024-09-28 11:40:45, PPPPP--PP-P---PPP-P- (60%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
string A[a];
string B[b];
string front[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
string value[]={"11","2","3","4","5","6","7","8","9","10","10","10","10"};
int totalA = 0;
int totalB = 0;
for(int i=0; i<a; ++i){
cin >> A[i];
for(int j=0; j<13; ++j){
if(A[i]==front[j]){
totalA += stoi(value[j]);
if((totalA > 21)&&(A[i] == front[0])){
value[0] = "1";
totalA = totalA - 10;
}
}
}
}
for(int i=0; i<b; ++i){
cin >> B[i];
for(int j=0; j<13; ++j){
if(B[i]==front[j]){
totalB += stoi(value[j]);
if((totalB > 21)&&(B[i] == front[0])){
value[0] = "1";
totalB = totalB - 10;
}
}
}
}
if(((totalA > 21) && (totalB > 21)) || (totalA == totalB)){
cout << "Draw" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalA > totalB){
cout << "A" << endl;
cout << totalA << " " << totalB << endl;
}else if(totalB > totalA){
cout << "B" << endl;
cout << totalA << " " << totalB << endl;
}
} |
# 2016995, 2024-09-28 12:44:42, P------------------- (5%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=1;
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=1;
}else{
sumb += stoi(Brr[i]);
}
}
////
if(suma>sumb && suma<21){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if(sumb>suma && sumb<21){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw<"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017016, 2024-09-28 12:46:59, P-PPP--P------------ (25%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=1;
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=1;
}else{
sumb += stoi(Brr[i]);
}
}
////
if(suma>sumb && suma<21){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if(sumb>suma && sumb<21){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017028, 2024-09-28 12:47:52, PPPPP--P--P--------- (35%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=1;
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=1;
}else{
sumb += stoi(Brr[i]);
}
}
////
if(suma>sumb && suma<=21){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if(sumb>suma && sumb<=21){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017060, 2024-09-28 12:50:43, PPPPP--P------P---P- (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if(suma>sumb && suma<=21){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if(sumb>suma && sumb<=21){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017082, 2024-09-28 12:53:15, PPPPP--P------P---P- (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if(suma>sumb && suma<=21){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if(sumb>suma && sumb<=21){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017094, 2024-09-28 12:55:01, PPPP-PP-----P-P--PP- (50%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || sumb>21){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || suma>21){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017103, 2024-09-28 12:56:26, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || (sumb>21 && suma<=21)){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || (suma>21 && sumb<=21)){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017441, 2024-09-28 13:29:38, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
if(suma>=21){
suma--;
}
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
if(sumb>=21){
sumb--;
}
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || (sumb>21 && suma<=21)){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || (suma>21 && sumb<=21)){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017631, 2024-09-28 13:52:00, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
if(suma>=21){
suma-=11;
}
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
if(sumb>=21){
sumb-=11;
}
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || (sumb>21 && suma<=21)){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || (suma>21 && sumb<=21)){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017639, 2024-09-28 13:53:01, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
if(suma>=21){
suma-=10;
}
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
if(sumb>=21){
sumb-=10;
}
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || (sumb>21 && suma<=21)){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || (suma>21 && sumb<=21)){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017650, 2024-09-28 13:54:05, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
if(suma>21){
suma-=10;
}
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
if(sumb>21){
sumb-=10;
}
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || (sumb>21 && suma<=21)){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || (suma>21 && sumb<=21)){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} | # 2017816, 2024-09-28 14:08:23, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
int startidx;
int skipidx = -1;
int minarr = INT_MAX;
for (int i = 0; i < n; i++)
{
cin>>arr[i];
if(arr[i]<minarr){
minarr = arr[i];
startidx = i;
}
}
for (int i = 1; i < n; i++)
{
if(arr[i-1] > arr[i]){
skipidx = i;
break;
}
}
int sum =0;
int idx = startidx;
int count = n ;
int timer = n;
int prev = arr[idx];
while (timer--)
{ if(arr[idx]>prev){
break;
}
if(idx == skipidx){
continue;
}
sum+=arr[idx];
idx++;
if(idx==count){
idx=0;
}
prev = arr[idx];
}
cout<<sum;
} | # 2018113, 2024-09-28 14:34:56, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
int suma=0,sumb=0;
cin>>a>>b;
string Arr[a];
string Brr[b];
for (int i = 0; i < a; i++)
{
cin>>Arr[i];
if(Arr[i] == "K" || Arr[i] == "Q" || Arr[i] == "J"){
suma+=10;
}else if(Arr[i] == "A"){
suma+=11;
if(suma>=21){
suma-=10;
if(suma>21){
suma-=10;
}
}
}else{
suma += stoi(Arr[i]);
}
}
for (int i = 0; i < b; i++)
{
cin>>Brr[i];
if(Brr[i] == "K" || Brr[i] == "Q" || Brr[i] == "J"){
sumb+=10;
}else if(Brr[i] == "A"){
sumb+=11;
if(sumb >=21){
sumb-=10;
if(sumb>21){
sumb-=10;
}
}
}else{
sumb += stoi(Brr[i]);
}
}
////
if((suma>sumb && suma<=21) || (sumb>21 && suma<=21)){
cout<<"A"<<endl;
cout<<suma<<" "<<sumb;
}else if((sumb>suma && sumb<=21) || (suma>21 && sumb<=21)){
cout<<"B"<<endl;
cout<<suma<<" "<<sumb;
}else{
cout<<"Draw"<<endl;
cout<<suma<<" "<<sumb;
}
} |
# 2015311, 2024-09-28 09:53:41, PP--P--PP---------P- (30%)
#include <bits/stdc++.h>
using namespace std ;
int main(){
int a,b ;
cin >> a >> b ;
cin.ignore();
string A ;
string B ;
int sumA = 0;
int sumB = 0;
for(int i=0;i<a;++i){
cin >> A ;
if(A == "A"){
if(sumA + 11 > 21){
sumA += 1 ;
}else{
sumA += 11 ;
}
}
else if(A =="2") sumA+= 2 ;
else if(A =="3") sumA+= 3 ;
else if(A =="4") sumA+= 4 ;
else if(A =="5") sumA+= 5 ;
else if(A =="6") sumA+= 6 ;
else if(A =="7") sumA+= 7 ;
else if(A =="8") sumA+= 8 ;
else if(A =="9") sumA+= 9 ;
else if(A == "10" || A == "J" || A == "K" || A == "Q")sumA += 10 ;
}
for(int i=0;i<b;++i){
cin >> B ;
if(B == "A"){
if(sumB + 11 > 21){
sumB += 1 ;
}else{
sumB += 11 ;
}
}
else if(B =="2") sumB+= 2 ;
else if(B =="3") sumB+= 3 ;
else if(B =="4") sumB+= 4 ;
else if(B =="5") sumB+= 5 ;
else if(B =="6") sumB+= 6 ;
else if(B =="7") sumB+= 7 ;
else if(B =="8") sumB+= 8 ;
else if(B =="9") sumB+= 9 ;
else if(B == "10" || B == "J" || B == "K" || B == "Q")sumB += 10 ;
}
if(sumA >21 && sumB > 21){
cout << "Draw\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumA > sumB){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}else if(sumA < sumB){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
} | # 2015354, 2024-09-28 09:57:58, PPPPP-PPP---P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std ;
int main(){
int a,b ;
cin >> a >> b ;
cin.ignore();
string A ;
string B ;
int sumA = 0;
int sumB = 0;
for(int i=0;i<a;++i){
cin >> A ;
if(A == "A"){
if(sumA + 11 > 21){
sumA += 1 ;
}else{
sumA += 11 ;
}
}
else if(A =="2") sumA+= 2 ;
else if(A =="3") sumA+= 3 ;
else if(A =="4") sumA+= 4 ;
else if(A =="5") sumA+= 5 ;
else if(A =="6") sumA+= 6 ;
else if(A =="7") sumA+= 7 ;
else if(A =="8") sumA+= 8 ;
else if(A =="9") sumA+= 9 ;
else if(A == "10" || A == "J" || A == "K" || A == "Q")sumA += 10 ;
}
for(int i=0;i<b;++i){
cin >> B ;
if(B == "A"){
if(sumB + 11 > 21){
sumB += 1 ;
}else{
sumB += 11 ;
}
}
else if(B =="2") sumB+= 2 ;
else if(B =="3") sumB+= 3 ;
else if(B =="4") sumB+= 4 ;
else if(B =="5") sumB+= 5 ;
else if(B =="6") sumB+= 6 ;
else if(B =="7") sumB+= 7 ;
else if(B =="8") sumB+= 8 ;
else if(B =="9") sumB+= 9 ;
else if(B == "10" || B == "J" || B == "K" || B == "Q")sumB += 10 ;
}
if(sumA >21 && sumB > 21 || sumA == sumB){
cout << "Draw\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > 21){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}else if(sumB > 21){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > sumA){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB < sumA){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}
} | # 2015419, 2024-09-28 10:03:13, PPPPP-PP----P-P--PP- (55%)
#include <bits/stdc++.h>
using namespace std ;
int main(){
int a,b ;
cin >> a >> b ;
cin.ignore();
string A ;
string B ;
int sumA = 0;
int sumB = 0;
for(int i=0;i<a;++i){
cin >> A ;
if(A == "A"){
if(sumA + 11 >= 21){
sumA += 1 ;
}else{
sumA += 11 ;
}
}
else if(A =="2") sumA+= 2 ;
else if(A =="3") sumA+= 3 ;
else if(A =="4") sumA+= 4 ;
else if(A =="5") sumA+= 5 ;
else if(A =="6") sumA+= 6 ;
else if(A =="7") sumA+= 7 ;
else if(A =="8") sumA+= 8 ;
else if(A =="9") sumA+= 9 ;
else if(A == "10" || A == "J" || A == "K" || A == "Q")sumA += 10 ;
}
for(int i=0;i<b;++i){
cin >> B ;
if(B == "A"){
if(sumB + 11 >= 21){
sumB += 1 ;
}else{
sumB += 11 ;
}
}
else if(B =="2") sumB+= 2 ;
else if(B =="3") sumB+= 3 ;
else if(B =="4") sumB+= 4 ;
else if(B =="5") sumB+= 5 ;
else if(B =="6") sumB+= 6 ;
else if(B =="7") sumB+= 7 ;
else if(B =="8") sumB+= 8 ;
else if(B =="9") sumB+= 9 ;
else if(B == "10" || B == "J" || B == "K" || B == "Q")sumB += 10 ;
}
if(sumA >21 && sumB > 21 || sumA == sumB){
cout << "Draw\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > 21){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}else if(sumB > 21){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > sumA){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB < sumA){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}
} | # 2015489, 2024-09-28 10:11:29, PPPPPPPP----P-P--PP- (60%)
#include <bits/stdc++.h>
using namespace std ;
int main(){
int a,b ;
cin >> a >> b ;
string A ;
string B ;
int sumA = 0;
int sumB = 0;
for(int i=0;i<a;++i){
cin >> A ;
if(A == "A"){
if(sumA + 11 >= 21){
sumA += 1 ;
}else{
sumA += 11 ;
}
}
else if(A =="2") sumA+= 2 ;
else if(A =="3") sumA+= 3 ;
else if(A =="4") sumA+= 4 ;
else if(A =="5") sumA+= 5 ;
else if(A =="6") sumA+= 6 ;
else if(A =="7") sumA+= 7 ;
else if(A =="8") sumA+= 8 ;
else if(A =="9") sumA+= 9 ;
else if(A == "10" || A == "J" || A == "K" || A == "Q")sumA += 10 ;
}
for(int i=0;i<b;++i){
cin >> B ;
if(B == "A"){
if(sumB + 11 >= 21){
sumB += 1 ;
}else{
sumB += 11 ;
}
}
else if(B =="2") sumB+= 2 ;
else if(B =="3") sumB+= 3 ;
else if(B =="4") sumB+= 4 ;
else if(B =="5") sumB+= 5 ;
else if(B =="6") sumB+= 6 ;
else if(B =="7") sumB+= 7 ;
else if(B =="8") sumB+= 8 ;
else if(B =="9") sumB+= 9 ;
else if(B == "10" || B == "J" || B == "K" || B == "Q")sumB += 10 ;
}
if(sumA >21 && sumB > 21 || sumA == sumB){
cout << "Draw\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > 21){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}else if(sumA > 21){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > sumA){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB < sumA){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}
} | # 2016040, 2024-09-28 11:07:34, PPPPPPPPP--P-------- (50%)
#include <bits/stdc++.h>
using namespace std ;
int main(){
int a,b ;
cin >> a >> b ;
string A ;
string B ;
int sumA = 0;
int sumB = 0;
for(int i=0;i<a;++i){
cin >> A ;
if(A == "A"){
if(sumA + 11 < 21){
sumA += 1 ;
}else{
sumA += 11 ;
}
}
else if(A =="2") sumA+= 2 ;
else if(A =="3") sumA+= 3 ;
else if(A =="4") sumA+= 4 ;
else if(A =="5") sumA+= 5 ;
else if(A =="6") sumA+= 6 ;
else if(A =="7") sumA+= 7 ;
else if(A =="8") sumA+= 8 ;
else if(A =="9") sumA+= 9 ;
else if(A == "10" || A == "J" || A == "K" || A == "Q")sumA += 10 ;
}
for(int i=0;i<b;++i){
cin >> B ;
if(B == "A"){
if(sumB + 11 < 21){
sumB += 1 ;
}else{
sumB += 11 ;
}
}
else if(B =="2") sumB+= 2 ;
else if(B =="3") sumB+= 3 ;
else if(B =="4") sumB+= 4 ;
else if(B =="5") sumB+= 5 ;
else if(B =="6") sumB+= 6 ;
else if(B =="7") sumB+= 7 ;
else if(B =="8") sumB+= 8 ;
else if(B =="9") sumB+= 9 ;
else if(B == "10" || B == "J" || B == "K" || B == "Q")sumB += 10 ;
}
if(sumA >21 && sumB > 21 || sumA == sumB){
cout << "Draw\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > 21){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}else if(sumA > 21){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB > sumA){
cout << "B\n" ;
cout << sumA << ' ' << sumB ;
}
else if(sumB < sumA){
cout << "A\n" ;
cout << sumA << ' ' << sumB ;
}
} |
# 2017471, 2024-09-28 13:32:03, PPPPP--PPPP---P-P-P- (60%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
int a,b;
string pol,sol;
cin>>a>>b;
vector<string> acard;
vector<string> bcard;
int count =0;
int non=0;
for(int i=0;i<a;i++){
cin>>pol;
acard.push_back(pol);
}
sort(acard.begin(),acard.end());
for(int i=0;i<b;i++){
cin>>sol;
bcard.push_back(sol);
}
sort(bcard.begin(),bcard.end());
for(int i =0;i < acard.size();i++){
if(acard[i] == "A"){
count++;
}else if(acard[i] == "J"){
non+= 10;
}else if(acard[i] == "Q"){
non+= 10;
}else if(acard[i] == "K"){
non+= 10;
}else{
non += stoi(acard[i]);
}
}
for(int i =0;i<count;i++){
if(non + 11 > 21){
non += 1;
}else{
non += 11;
}
}
int ton = 0;
int kot =0;
for(int i =0;i < bcard.size();i++){
if(bcard[i] == "A"){
ton++;
}else if(bcard[i] == "J"){
kot+= 10;
}else if(bcard[i] == "Q"){
kot+= 10;
}else if(bcard[i] == "K"){
kot+= 10;
}else{
kot += stoi(bcard[i]);
}
}
for(int i =0;i<ton;i++){
if(kot + 11 > 21){
kot += 1;
}else{
kot += 11;
}
}
if(non > kot && non <= 21){
cout<<"A"<<endl;
}else if(kot> non && kot <= 21){
cout<<"B"<<endl;
}else {
cout<<"Draw"<<endl;
}
cout << non<<" ";
cout <<kot;
} | # 2018616, 2024-09-28 15:12:33, PxPPPx-xPx---xP-P-P- (40%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
int a,b;
string pol,sol;
cin>>a>>b;
vector<string> acard;
vector<string> bcard;
int count =0;
int non=0;
for(int i=0;i<a;i++){
cin>>pol;
acard.push_back(pol);
}
for(int i=0;i<b;i++){
cin>>sol;
bcard.push_back(sol);
}
for(int i =0;i < acard.size();i++){
if(acard[i] == "A"){
count++;
}else if(acard[i] == "J"){
non += 10;
}else if(bcard[i] == "Q"){
non += 10;
}else if(bcard[i] == "K"){
non += 10;
}else{
non += stoi(acard[i]);
}
}
for(int i =0;i<count;i++){
if(non + 11 > 21){
non += 1;
}else{
non += 11;
}
}
int ton = 0;
int kot =0;
for(int i =0;i < bcard.size();i++){
if(bcard[i] == "A"){
ton++;
}else if(bcard[i] == "J"){
kot+= 10;
}else if(bcard[i] == "Q"){
kot+= 10;
}else if(bcard[i] == "K"){
kot+= 10;
}else{
kot += stoi(bcard[i]);
}
}
for(int i =0;i<ton;i++){
if(kot + 11 > 21){
kot += 1;
}else{
kot += 11;
}
}
if(non > kot && non <= 21){
cout<<"A"<<endl;
}else if(kot > non && kot <= 21){
cout<<"B"<<endl;
}else {
cout<<"Draw"<<endl;
}
cout << non<<" ";
cout <<kot;
} | # 2018679, 2024-09-28 15:15:24, PPPPP--PPPP---P-P-P- (60%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
int a,b;
string pol,sol;
cin>>a>>b;
vector<string> acard;
vector<string> bcard;
int count =0;
int non=0;
for(int i=0;i<a;i++){
cin>>pol;
acard.push_back(pol);
}
for(int i=0;i<b;i++){
cin>>sol;
bcard.push_back(sol);
}
for(int i =0;i < acard.size();i++){
if(acard[i] == "A"){
count++;
}else if(acard[i] == "J"){
non += 10;
}else if(acard[i] == "Q"){
non += 10;
}else if(acard[i] == "K"){
non += 10;
}else{
non += stoi(acard[i]);
}
}
for(int i =0;i< count;i++){
if(non + 11 > 21){
non += 1;
}else{
non += 11;
}
}
int ton = 0;
int kot =0;
for(int i =0;i < bcard.size();i++){
if(bcard[i] == "A"){
ton++;
}else if(bcard[i] == "J"){
kot+= 10;
}else if(bcard[i] == "Q"){
kot+= 10;
}else if(bcard[i] == "K"){
kot+= 10;
}else{
kot += stoi(bcard[i]);
}
}
for(int i =0;i<ton;i++){
if(kot + 11 > 21){
kot += 1;
}else{
kot += 11;
}
}
if(non > kot && non <= 21){
cout<<"A"<<endl;
}else if(kot > non && kot <= 21){
cout<<"B"<<endl;
}else {
cout<<"Draw"<<endl;
}
cout << non<<" ";
cout <<kot;
} |
# 2017396, 2024-09-28 13:25:55, Compilation error (0%)
#include <iostream>
using namespace std;
int main(){
char pi[12] ={2,3,4,5,6,7,8,9,10,J,Q,K};
int piv [12] ={2,3,4,5,6,7,8,9,10,10,10,10};
char pia[1] = {A};
int pia1[2] = {1,11};
char A1[A];
char B1[B];
int A,B,va = 0,vb = 0;
cin >> A >> B;
for(int i =0,j =0; i < A,j <B; i++ ,j++){
cin >> A1[i] >> B1[j];
}
for(int k =0; k < A; k++){
for(int m =0; m < 12; m++){
if(A1[k] == pi[m] && A1[k] != A){
va += piv[m];
}
}}
for(int k =0; k < B; k++){
for(int m =0; m < 12; m++){
if(A1[k] == pi[m] && A1[k] != A){
vb += piv[m];
}
}}
/*for(int n = 0;)*/
if(va > vb){
cout << 'A';
} else if(vb > va){
cout << 'B';
} else{
cout << "Draw";
}
cout << endl;
cout << va << vb;
return 0;
} | # 2017439, 2024-09-28 13:29:31, Compilation error (0%)
#include <iostream>
using namespace std;
int main(){
char pi[13] ={'2','3','4','5','6','7','8','9','10','J','Q','K' };
int piv [12] ={2,3,4,5,6,7,8,9,10,10,10,10};
char pia[1] = {'A'};
int pia1[2] = {1,11};
int A,B,va = 0,vb = 0;
cin >> A >> B;
char A1[A];
char B1[B];
for(int i =0,j =0; i < A,j <B; i++ ,j++){
cin >> A1[i] >> B1[j];
}
for(int k =0; k < A; k++){
for(int m =0; m < 12; m++){
if(A1[k] == pi[m] && A1[k] != A){
va += piv[m];
}
}}
for(int k =0; k < B; k++){
for(int m =0; m < 12; m++){
if(A1[k] == pi[m] && A1[k] != A){
vb += piv[m];
}
}}
/*for(int n = 0;)*/
if(va > vb){
cout << 'A';
} else if(vb > va){
cout << 'B';
} else{
cout << "Draw";
}
cout << endl;
cout << va << vb;
return 0;
} | # 2017874, 2024-09-28 14:12:22, -------------------- (0%)
#include <iostream>
using namespace std;
int main()
{
char pi[12] = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
string ten[1] = {"10"};
int piv[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};
char pia[4] = {'A'};
int pia1[2] = {1, 11};
int sizepi = sizeof(pi) / sizeof(pi[0]);
int A, B, va = 0, vb = 0;
cin >> A;
string A1, B1;
cin.ignore();
getline(cin,A1);
cin.ignore();
getline(cin,B1);
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9'))
if (A1[k] == pi[m])
{
if( k ==0 || k == A1.length()-1){
va+=piv[m];}
else if ((A1[k] == 1 && A1[k + 1] == 0))
{
va += piv[8];
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9'))
if (A1[k] == pi[m])
{
if( k ==0 || k == A1.length()-1){
va+=piv[m];}
else if ((A1[k] == 1 && A1[k + 1] == 0))
{
va += piv[8];
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
if(va > vb){
cout << 'A';
} else if(vb > va){
cout << 'B';
} else{
cout << "Draw";
}
cout << endl;
cout << va << vb;
return 0;
} | # 2018002, 2024-09-28 14:24:02, P-PPP--------------- (20%)
#include <iostream>
using namespace std;
int main()
{
char pi[12] = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
int piv[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10};
char pia[4] = {'A'};
int pia1[2] = {1, 11};
int sizepi = sizeof(pi) / sizeof(pi[0]);
int A, B, va = 0, vb = 0;
cin >> A >> B;
string A1, B1;
cin.ignore();
getline(cin,A1);
getline(cin,B1);
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9')){
if (A1[k] == pi[m])
{
if( k ==0 || k == A1.length()-1){
va+=piv[m];}
else if ((A1[k] == 1 && A1[k + 1] == 0))
{
va += 10;
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
}
for (int k = 0; k < B1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((B1[k] >= 'A' && B1[k] <= 'Z') || (B1[k] >= '0' && B1[k] <= '9')){
if (B1[k] == pi[m])
{
if( k ==0 || k == B1.length()-1){
vb +=piv[m];}
else if ((B1[k] == 1 && B1[k + 1] == 0))
{
vb += 10;
}
else if (B1[k - 1] == ' ' && B1[k + 1] == ' ')
{
vb += piv[m];
}
}
}
}
}
if(va > vb){
cout << 'A';
} else if(vb > va){
cout << 'B';
} else{
cout << "Draw";
}
cout << endl;
cout << va << " " << vb;
return 0;
} | # 2018127, 2024-09-28 14:36:25, P-PPP----PP---P-P--P (45%)
#include <iostream>
using namespace std;
int main()
{
char pi[12] = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
int piv[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10};
char pia[1] = {'A'};
int pia1[2] = {1, 11};
int sizepi = sizeof(pi) / sizeof(pi[0]);
int A, B, va = 0, vb = 0;
cin >> A >> B;
string A1, B1;
cin.ignore();
getline(cin,A1);
getline(cin,B1);
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9')){
if (A1[k] == pi[m])
{
if( k ==0 || k == A1.length()-1){
va+=piv[m];}
else if ((A1[k] == '1' && A1[k + 1] == '0'))
{
va += 10;
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
}
for (int k = 0; k < B1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((B1[k] >= 'A' && B1[k] <= 'Z') || (B1[k] >= '0' && B1[k] <= '9')){
if (B1[k] == pi[m])
{
if( k ==0 || k == B1.length()-1 ){
vb +=piv[m];}
else if ((B1[k] == '1' && B1[k + 1] == '0'))
{
vb += 10;
}
else if (B1[k - 1] == ' ' && B1[k + 1] == ' ')
{
vb += piv[m];
}
}
}
}
}
for (int k = 0; k < A1.length(); k++)
{if(A1[k] == 'A'){
if(va <= 10){
va+=11;
continue;
}if(va > 10 ){
va+=1;
continue;
}
if(va == 21){
break;
}
}
}for (int k = 0; k < B1.length(); k++)
{if(B1[k] == 'A'){
if(vb <= 10){
vb+=11;
continue;
}if(vb == 21){
break;
}if(vb > 10 ){
vb+=1;
continue;
}
}
}
if(va > vb){
cout << 'A';
} else if(vb > va){
cout << 'B';
} else{
cout << "Draw";
}
cout << endl;
cout << va << " " << vb;
return 0;
} | # 2018181, 2024-09-28 14:41:28, PPPPP---P-P---P-P-P- (50%)
#include <iostream>
using namespace std;
int main()
{
char pi[12] = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
int piv[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10};
char pia[1] = {'A'};
int pia1[2] = {1, 11};
int sizepi = sizeof(pi) / sizeof(pi[0]);
int A, B, va = 0, vb = 0;
cin >> A >> B;
string A1, B1;
cin.ignore();
getline(cin, A1);
getline(cin, B1);
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9'))
{
if (A1[k] == pi[m])
{
if (k == 0 || k == A1.length() - 1)
{
va += piv[m];
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
}
for (int k = 0; k < B1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((B1[k] >= 'A' && B1[k] <= 'Z') || (B1[k] >= '0' && B1[k] <= '9'))
{
if (B1[k] == pi[m])
{
if (k == 0 || k == B1.length() - 1)
{
vb += piv[m];
}
else if (B1[k - 1] == ' ' && B1[k + 1] == ' ')
{
vb += piv[m];
}
}
}
}
}
for (int k = 0; k < A1.length(); k++)
{
if (A1[k] == 'A')
{
if (va <= 10)
{
va += 11;
continue;
}
if (va > 10)
{
va += 1;
continue;
}
if (va == 21)
{
break;
}
}
}
for (int k = 0; k < B1.length(); k++)
{
if (B1[k] == 'A')
{
if (vb <= 10)
{
vb += 11;
continue;
}
if (vb == 21)
{
break;
}
if (vb > 10)
{
vb += 1;
continue;
}
}
}
for (int k = 0; k < A1.length(); k++)
{
if (A1[k] == '1' && A1[k+1] == '0')
{
va+=10;
}}
for (int k = 0; k < B1.length(); k++)
{
if (B1[k] == '1' && B1[k+1] == '0')
{
vb+=10;
}}
if (va > vb)
{
cout << 'A';
}
else if (vb > va)
{
cout << 'B';
}
else
{
cout << "Draw";
}
cout << endl;
cout << va << " " << vb;
return 0;
} | # 2018521, 2024-09-28 15:06:56, PPPPP--PP-P---P-P-P- (55%)
#include <iostream>
using namespace std;
int main()
{
char pi[12] = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
int piv[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10};
char pia[1] = {'A'};
int pia1[2] = {1, 11};
int sizepi = sizeof(pi) / sizeof(pi[0]);
int A, B, va = 0, vb = 0;
cin >> A >> B;
string A1, B1;
cin.ignore();
getline(cin, A1);
getline(cin, B1);
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9'))
{
if (A1[k] == pi[m])
{
if (k == 0 || k == A1.length() - 1)
{
va += piv[m];
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
}
for (int k = 0; k < B1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((B1[k] >= 'A' && B1[k] <= 'Z') || (B1[k] >= '0' && B1[k] <= '9'))
{
if (B1[k] == pi[m])
{
if (k == 0 || k == B1.length() - 1)
{
vb += piv[m];
}
else if (B1[k - 1] == ' ' && B1[k + 1] == ' ')
{
vb += piv[m];
}
}
}
}
}
for (int k = 0; k < A1.length(); k++)
{
if (A1[k] == 'A')
{
if (va <= 10)
{
va += 11;
continue;
}
if (va > 10)
{
va += 1;
continue;
}
if (va == 21)
{
break;
}
}
}
for (int k = 0; k < B1.length(); k++)
{
if (B1[k] == 'A')
{
if (vb <= 10)
{
vb += 11;
continue;
}
if (vb == 21)
{
break;
}
if (vb > 10)
{
vb += 1;
continue;
}
}
}
for (int k = 0; k < A1.length(); k++)
{
if (A1[k] == '1' && A1[k+1] == '0')
{
va+=10;
}}
for (int k = 0; k < B1.length(); k++)
{
if (B1[k] == '1' && B1[k+1] == '0')
{
vb+=10;
}}
if (va > vb && va <= 21)
{
cout << 'A';
}
else if (vb > va && vb <= 21)
{
cout << 'B';
}
else if((va > 21 && vb > 21) || va == vb )
{
cout << "Draw";
}
cout << endl;
cout << va << " " << vb;
return 0;
} | # 2018552, 2024-09-28 15:09:30, PPPPP--PP-P---P-P-P- (55%)
#include <iostream>
using namespace std;
int main()
{
char pi[12] = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
int piv[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10};
char pia[1] = {'A'};
int pia1[2] = {1, 11};
int sizepi = sizeof(pi) / sizeof(pi[0]);
int A, B, va = 0, vb = 0;
cin >> A >> B;
string A1, B1;
cin.ignore();
getline(cin, A1);
getline(cin, B1);
for (int k = 0; k < A1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((A1[k] >= 'A' && A1[k] <= 'Z') || (A1[k] >= '0' && A1[k] <= '9'))
{
if (A1[k] == pi[m])
{
if (k == 0 || k == A1.length() - 1)
{
va += piv[m];
}
else if (A1[k - 1] == ' ' && A1[k + 1] == ' ')
{
va += piv[m];
}
}
}
}
}
for (int k = 0; k < B1.length(); k++)
{
for (int m = 0; m < sizepi; m++)
{
if ((B1[k] >= 'A' && B1[k] <= 'Z') || (B1[k] >= '0' && B1[k] <= '9'))
{
if (B1[k] == pi[m])
{
if (k == 0 || k == B1.length() - 1)
{
vb += piv[m];
}
else if (B1[k - 1] == ' ' && B1[k + 1] == ' ')
{
vb += piv[m];
}
}
}
}
}
for (int k = 0; k < A1.length(); k++)
{
if (A1[k] == 'A')
{
if (va <= 10)
{
va += 11;
continue;
}
if (va > 10)
{
va += 1;
continue;
}
if (va == 21)
{
break;
}
}
}
for (int k = 0; k < A1.length(); k++)
{
if (A1[k] == '1' && A1[k+1] == '0')
{
va+=10;
}}
for (int k = 0; k < B1.length(); k++)
{
if (B1[k] == '1' && B1[k+1] == '0')
{
vb+=10;
}}
for (int k = 0; k < B1.length(); k++)
{
if (B1[k] == 'A')
{
if (vb <= 10)
{
vb += 11;
continue;
}
if (vb == 21)
{
break;
}
if (vb > 10)
{
vb += 1;
continue;
}
}
}
if (va > vb && va <= 21)
{
cout << 'A';
}
else if (vb > va && vb <= 21)
{
cout << 'B';
}
else if((va > 21 && vb > 21) || va == vb )
{
cout << "Draw";
}
cout << endl;
cout << va << " " << vb;
return 0;
} |
# 2017296, 2024-09-28 13:15:48, P-PP---------------- (15%)
#include <iostream>
#include <string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
char na[a], nb[b];
for (int i = 0; i < a; ++i) {
cin >> na[i];
}
for (int i = 0; i < a; ++i) {
cin >> nb[i];
}
int total_A = 0;
for (int i = 0; i < a; ++i) {
if (na[i] == 'J' || na[i] == 'Q' || na[i] == 'K' || na[i] == 'A') {
total_A += 10;
}
if (na[i] == '2') {
total_A += 2;
}
if (na[i] == '3') {
total_A += 3;
}
if (na[i] == '4') {
total_A += 4;
}
if (na[i] == '5') {
total_A += 5;
}
if (na[i] == '6') {
total_A += 6;
}
if (na[i] == '7') {
total_A += 7;
}
if (na[i] == '8') {
total_A += 8;
}
if (na[i] == '9') {
total_A += 9;
}
}
int total_B = 0;
for (int i = 0; i < a; ++i) {
if (nb[i] == 'J' || nb[i] == 'Q' || nb[i] == 'K' || nb[i] == 'A') {
total_B += 10;
}
if (nb[i] == '2') {
total_B += 2;
}
if (nb[i] == '3') {
total_B += 3;
}
if (nb[i] == '4') {
total_B += 4;
}
if (nb[i] == '5') {
total_B += 5;
}
if (nb[i] == '6') {
total_B += 6;
}
if (nb[i] == '7') {
total_B += 7;
}
if (nb[i] == '8') {
total_B += 8;
}
if (nb[i] == '9') {
total_B += 9;
}
}
if ((total_A > total_B && total_A <= 21) || total_B > 21) {
cout << "A" << endl;
}
else if ((total_A < total_B && total_B <= 21) || total_A > 21) {
cout << "B" << endl;
}
else if ((total_A > 21 && total_B > 21) || total_A == total_B) {
cout << "Draw" << endl;
}
else {
cout << "Draw" << endl;
}
cout << total_A << " " << total_B << endl;
} | # 2017358, 2024-09-28 13:22:15, P-PP-----P-------P-- (25%)
#include <iostream>
#include <string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
char na[a], nb[b];
for (int i = 0; i < a; ++i) {
cin >> na[i];
}
for (int i = 0; i < a; ++i) {
cin >> nb[i];
}
int total_A = 0;
for (int i = 0; i < a; ++i) {
if (na[i] == 'J' || na[i] == 'Q' || na[i] == 'K') {
total_A += 10;
}
else if (na[i] == '2') {
total_A += 2;
}
else if (na[i] == '3') {
total_A += 3;
}
else if (na[i] == '4') {
total_A += 4;
}
else if (na[i] == '5') {
total_A += 5;
}
else if (na[i] == '6') {
total_A += 6;
}
else if (na[i] == '7') {
total_A += 7;
}
else if (na[i] == '8') {
total_A += 8;
}
else if (na[i] == '9') {
total_A += 9;
}
else if (na[i] == 'A') {
if (total_A <= 10) {
total_A += 11;
}
else if (total_A > 10) {
total_A += 1;
}
}
}
int total_B = 0;
for (int i = 0; i < a; ++i) {
if (nb[i] == 'J' || nb[i] == 'Q' || nb[i] == 'K') {
total_B += 10;
}
else if (nb[i] == '2') {
total_B += 2;
}
else if (nb[i] == '3') {
total_B += 3;
}
else if (nb[i] == '4') {
total_B += 4;
}
else if (nb[i] == '5') {
total_B += 5;
}
else if (nb[i] == '6') {
total_B += 6;
}
else if (nb[i] == '7') {
total_B += 7;
}
else if (nb[i] == '8') {
total_B += 8;
}
else if (nb[i] == '9') {
total_B += 9;
}
else if (nb[i] == 'A') {
if (total_B <= 10) {
total_B += 11;
}
else if (total_B > 10) {
total_B += 1;
}
}
}
if ((total_A > total_B && total_A <= 21) || total_B > 21) {
cout << "A" << endl;
}
else if ((total_A < total_B && total_B <= 21) || total_A > 21) {
cout << "B" << endl;
}
else if ((total_A > 21 && total_B > 21) || total_A == total_B) {
cout << "Draw" << endl;
}
else {
cout << "Draw" << endl;
}
cout << total_A << " " << total_B << endl;
} | # 2017384, 2024-09-28 13:25:08, P-PP-------------P-- (20%)
#include <iostream>
#include <string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
char na[a], nb[b];
for (int i = 0; i < a; ++i) {
cin >> na[i];
}
for (int i = 0; i < b; ++i) {
cin >> nb[i];
}
int total_A = 0;
for (int i = 0; i < a; ++i) {
if (na[i] == 'J' || na[i] == 'Q' || na[i] == 'K') {
total_A += 10;
}
else if (na[i] == '2') {
total_A += 2;
}
else if (na[i] == '3') {
total_A += 3;
}
else if (na[i] == '4') {
total_A += 4;
}
else if (na[i] == '5') {
total_A += 5;
}
else if (na[i] == '6') {
total_A += 6;
}
else if (na[i] == '7') {
total_A += 7;
}
else if (na[i] == '8') {
total_A += 8;
}
else if (na[i] == '9') {
total_A += 9;
}
else if (na[i] == 'A') {
if (total_A <= 10) {
total_A += 11;
}
else if (total_A > 10) {
total_A += 1;
}
}
}
int total_B = 0;
for (int i = 0; i < a; ++i) {
if (nb[i] == 'J' || nb[i] == 'Q' || nb[i] == 'K') {
total_B += 10;
}
else if (nb[i] == '2') {
total_B += 2;
}
else if (nb[i] == '3') {
total_B += 3;
}
else if (nb[i] == '4') {
total_B += 4;
}
else if (nb[i] == '5') {
total_B += 5;
}
else if (nb[i] == '6') {
total_B += 6;
}
else if (nb[i] == '7') {
total_B += 7;
}
else if (nb[i] == '8') {
total_B += 8;
}
else if (nb[i] == '9') {
total_B += 9;
}
else if (nb[i] == 'A') {
if (total_B <= 10) {
total_B += 11;
}
else if (total_B > 10) {
total_B += 1;
}
}
}
if ((total_A > total_B && total_A <= 21) || total_B > 21) {
cout << "A" << endl;
}
else if ((total_A < total_B && total_B <= 21) || total_A > 21) {
cout << "B" << endl;
}
else if ((total_A > 21 && total_B > 21) || total_A == total_B) {
cout << "Draw" << endl;
}
else {
cout << "Draw" << endl;
}
cout << total_A << " " << total_B << endl;
} | # 2017394, 2024-09-28 13:25:48, P-PP--P-----P-P--P-- (35%)
#include <iostream>
#include <string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
char na[a], nb[b];
for (int i = 0; i < a; ++i) {
cin >> na[i];
}
for (int i = 0; i < b; ++i) {
cin >> nb[i];
}
int total_A = 0;
for (int i = 0; i < a; ++i) {
if (na[i] == 'J' || na[i] == 'Q' || na[i] == 'K') {
total_A += 10;
}
else if (na[i] == '2') {
total_A += 2;
}
else if (na[i] == '3') {
total_A += 3;
}
else if (na[i] == '4') {
total_A += 4;
}
else if (na[i] == '5') {
total_A += 5;
}
else if (na[i] == '6') {
total_A += 6;
}
else if (na[i] == '7') {
total_A += 7;
}
else if (na[i] == '8') {
total_A += 8;
}
else if (na[i] == '9') {
total_A += 9;
}
else if (na[i] == 'A') {
if (total_A <= 10) {
total_A += 11;
}
else if (total_A > 10) {
total_A += 1;
}
}
}
int total_B = 0;
for (int i = 0; i < b; ++i) {
if (nb[i] == 'J' || nb[i] == 'Q' || nb[i] == 'K') {
total_B += 10;
}
else if (nb[i] == '2') {
total_B += 2;
}
else if (nb[i] == '3') {
total_B += 3;
}
else if (nb[i] == '4') {
total_B += 4;
}
else if (nb[i] == '5') {
total_B += 5;
}
else if (nb[i] == '6') {
total_B += 6;
}
else if (nb[i] == '7') {
total_B += 7;
}
else if (nb[i] == '8') {
total_B += 8;
}
else if (nb[i] == '9') {
total_B += 9;
}
else if (nb[i] == 'A') {
if (total_B <= 10) {
total_B += 11;
}
else if (total_B > 10) {
total_B += 1;
}
}
}
if ((total_A > total_B && total_A <= 21) || total_B > 21) {
cout << "A" << endl;
}
else if ((total_A < total_B && total_B <= 21) || total_A > 21) {
cout << "B" << endl;
}
else if ((total_A > 21 && total_B > 21) || total_A == total_B) {
cout << "Draw" << endl;
}
else {
cout << "Draw" << endl;
}
cout << total_A << " " << total_B << endl;
} | # 2017419, 2024-09-28 13:28:05, P-PPP-P-----P-P--P-- (40%)
#include <iostream>
#include <string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
char na[a], nb[b];
for (int i = 0; i < a; ++i) {
cin >> na[i];
}
for (int i = 0; i < b; ++i) {
cin >> nb[i];
}
int total_A = 0;
for (int i = 0; i < a; ++i) {
if (na[i] == 'J' || na[i] == 'Q' || na[i] == 'K') {
total_A += 10;
}
else if (na[i] == '2') {
total_A += 2;
}
else if (na[i] == '3') {
total_A += 3;
}
else if (na[i] == '4') {
total_A += 4;
}
else if (na[i] == '5') {
total_A += 5;
}
else if (na[i] == '6') {
total_A += 6;
}
else if (na[i] == '7') {
total_A += 7;
}
else if (na[i] == '8') {
total_A += 8;
}
else if (na[i] == '9') {
total_A += 9;
}
else if (na[i] == 'A') {
if (total_A <= 10) {
total_A += 11;
}
else if (total_A > 10) {
total_A += 1;
}
}
}
int total_B = 0;
for (int i = 0; i < b; ++i) {
if (nb[i] == 'J' || nb[i] == 'Q' || nb[i] == 'K') {
total_B += 10;
}
else if (nb[i] == '2') {
total_B += 2;
}
else if (nb[i] == '3') {
total_B += 3;
}
else if (nb[i] == '4') {
total_B += 4;
}
else if (nb[i] == '5') {
total_B += 5;
}
else if (nb[i] == '6') {
total_B += 6;
}
else if (nb[i] == '7') {
total_B += 7;
}
else if (nb[i] == '8') {
total_B += 8;
}
else if (nb[i] == '9') {
total_B += 9;
}
else if (nb[i] == 'A') {
if (total_B <= 10) {
total_B += 11;
}
else if (total_B > 10) {
total_B += 1;
}
}
}
if ((total_A > total_B && total_A <= 21) || (total_B > 21 && total_A <= 21)) {
cout << "A" << endl;
}
else if ((total_A < total_B && total_B <= 21) || (total_A > 21 && total_B <= 21)) {
cout << "B" << endl;
}
else if ((total_A > 21 && total_B > 21) || total_A == total_B) {
cout << "Draw" << endl;
}
else {
cout << "Draw" << endl;
}
cout << total_A << " " << total_B << endl;
} | # 2017927, 2024-09-28 14:17:07, P-PPP-P---PPP-P-PP-- (55%)
#include <iostream>
#include <string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
char na[a], nb[b];
for (int i = 0; i < a; ++i) {
cin >> na[i];
}
for (int i = 0; i < b; ++i) {
cin >> nb[i];
}
int total_A = 0;
for (int i = 0; i < a; ++i) {
if (na[i] == 'J' || na[i] == 'Q' || na[i] == 'K') {
total_A += 10;
}
else if (na[i] == '2') {
total_A += 2;
}
else if (na[i] == '3') {
total_A += 3;
}
else if (na[i] == '4') {
total_A += 4;
}
else if (na[i] == '5') {
total_A += 5;
}
else if (na[i] == '6') {
total_A += 6;
}
else if (na[i] == '7') {
total_A += 7;
}
else if (na[i] == '8') {
total_A += 8;
}
else if (na[i] == '9') {
total_A += 9;
}
}
for (int i = 0; i < a; ++i) {
if (na[i] == 'A') {
if (total_A > 10) {
total_A += 1;
}
else if (total_A <= 10) {
total_A += 11;
}
}
}
int total_B = 0;
for (int i = 0; i < b; ++i) {
if (nb[i] == 'J' || nb[i] == 'Q' || nb[i] == 'K') {
total_B += 10;
}
else if (nb[i] == '2') {
total_B += 2;
}
else if (nb[i] == '3') {
total_B += 3;
}
else if (nb[i] == '4') {
total_B += 4;
}
else if (nb[i] == '5') {
total_B += 5;
}
else if (nb[i] == '6') {
total_B += 6;
}
else if (nb[i] == '7') {
total_B += 7;
}
else if (nb[i] == '8') {
total_B += 8;
}
else if (nb[i] == '9') {
total_B += 9;
}
}
for (int i = 0; i < b; ++i) {
if (nb[i] == 'A') {
if (total_B > 10) {
total_B += 1;
}
else if (total_B <= 10) {
total_B += 11;
}
}
}
if ((total_A > total_B && total_A <= 21) || (total_B > 21 && total_A <= 21)) {
cout << "A" << endl;
}
else if ((total_A < total_B && total_B <= 21) || (total_A > 21 && total_B <= 21)) {
cout << "B" << endl;
}
else if ((total_A > 21 && total_B > 21) || total_A == total_B) {
cout << "Draw" << endl;
}
else {
cout << "Draw" << endl;
}
cout << total_A << " " << total_B << endl;
} |
# 2015976, 2024-09-28 11:00:59, PPPPP-----P--------- (30%)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int a, b, suma = 0, sumb = 0;
string BJ[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
int value[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};
string A[10], B[10];
cin >> a >> b;
for (int i = 0; i < a; i++){
cin >> A[i];
}
for (int j = 0; j < b; j++){
cin >> B[j];
}
for (int u = 0; u < a; u++){
for (int k = 0; k < 13; k++){
if (A[u] == BJ[k]){
suma += value[k];
}
}
}
for (int p = 0; p < b; p++){
for (int q = 0; q < 13; q++){
if (B[p] == BJ[q]){
sumb += value[q];
}
}
}
if (suma > sumb){
cout << "A" << endl;
}
else if (suma < sumb){
cout << "B" << endl;
}
else if (suma == sumb){
cout << "Draw" << endl;
}
cout << suma << " " << sumb << endl;
} | # 2016017, 2024-09-28 11:04:12, PPPPP---P----------- (30%)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int a, b, suma = 0, sumb = 0;
string BJ[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
int value[13] = {11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};
string A[10], B[10];
cin >> a >> b;
for (int i = 0; i < a; i++){
cin >> A[i];
}
for (int j = 0; j < b; j++){
cin >> B[j];
}
for (int u = 0; u < a; u++){
for (int k = 0; k < 13; k++){
if (A[u] == BJ[k]){
suma += value[k];
}
}
}
for (int p = 0; p < b; p++){
for (int q = 0; q < 13; q++){
if (B[p] == BJ[q]){
sumb += value[q];
}
}
}
if (suma > sumb){
cout << "A" << endl;
}
else if (suma < sumb){
cout << "B" << endl;
}
else if (suma == sumb){
cout << "Draw" << endl;
}
cout << suma << " " << sumb << endl;
} | # 2016158, 2024-09-28 11:18:57, PPPPP---P-P--------- (35%)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int a, b, sum_before_a = 0, sum_before_b = 0,suma = 0, sumb = 0;
string BJ[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
int value[13] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};
string A[10], B[10];
cin >> a >> b;
for (int i = 0; i < a; i++){
cin >> A[i];
}
for (int j = 0; j < b; j++){
cin >> B[j];
}
int counta = 0, countb = 0;
for (int r = 0; r < a; r++){
if (A[r] == "A"){
counta++;
}
for (int s = 0; s < 13; s++){
if (A[r] == BJ[s]){
sum_before_a += value[s];
}
}
}
if (counta == 1){
if (21 - sum_before_a >= 11){
value[0] = 11;
}
else if (21 - sum_before_a < 11){
value[0] = 1;
}
}
for (int u = 0; u < a; u++){
for (int k = 0; k < 13; k++){
if (A[u] == BJ[k]){
suma += value[k];
}
}
}
for (int t = 0; t < b; t++){
if (B[t] == "A"){
countb++;
}
for (int v = 0; v < 13; v++){
if (B[t] == BJ[v]){
sum_before_b += value[v];
}
}
}
if (countb == 1){
if (21 - sum_before_b >= 11){
value[0] = 11;
}
else if (21 - sum_before_b < 11){
value[0] = 1;
}
}
for (int p = 0; p < b; p++){
for (int q = 0; q < 13; q++){
if (B[p] == BJ[q]){
sumb += value[q];
}
}
}
if (suma > sumb){
cout << "A" << endl;
}
else if (suma < sumb){
cout << "B" << endl;
}
else if (suma == sumb){
cout << "Draw" << endl;
}
cout << suma << " " << sumb << endl;
} | # 2016430, 2024-09-28 11:41:41, PPPPPPPPP-PP-------- (55%)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int a, b, sum_before_a = 0, sum_before_b = 0,suma = 0, sumb = 0;
string BJ[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
int value[13] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};
string A[10], B[10];
cin >> a >> b;
for (int i = 0; i < a; i++){
cin >> A[i];
}
for (int j = 0; j < b; j++){
cin >> B[j];
}
int counta = 0, countb = 0;
for (int r = 0; r < a; r++){
if (A[r] == "A"){
counta++;
}
for (int s = 0; s < 13; s++){
if (A[r] == BJ[s]){
sum_before_a += value[s];
}
}
}
if (counta == 1){
if (21 - sum_before_a >= 11){
value[0] = 11;
}
else if (21 - sum_before_a < 11){
value[0] = 1;
}
}
for (int u = 0; u < a; u++){
for (int k = 0; k < 13; k++){
if (A[u] == BJ[k]){
suma += value[k];
}
}
}
for (int t = 0; t < b; t++){
if (B[t] == "A"){
countb++;
}
for (int v = 0; v < 13; v++){
if (B[t] == BJ[v]){
sum_before_b += value[v];
}
}
}
if (countb == 1){
if (21 - sum_before_b >= 11){
value[0] = 11;
}
else if (21 - sum_before_b < 11){
value[0] = 1;
}
}
for (int p = 0; p < b; p++){
for (int q = 0; q < 13; q++){
if (B[p] == BJ[q]){
sumb += value[q];
}
}
}
if (((suma < 22) && (sumb < 22)) && (suma > sumb)){
cout << "A" << endl;
}
else if (((suma < 22) && (sumb < 22)) && (suma < sumb)){
cout << "B" << endl;
}
else if ((suma < 22) && (sumb > 21)){
cout << "A" << endl;
}
else if ((suma > 21) && (sumb < 22)){
cout << "B" << endl;
}
else if ((suma > 21) && (sumb > 21)){
cout << "Draw" << endl;
}
else if (suma == sumb){
cout << "Draw" << endl;
}
cout << suma << " " << sumb << endl;
} |
# 2017717, 2024-09-28 14:01:21, P-PPP-P---PPP-P-PP-- (55%)
#include <iostream>
using namespace std;
int main (){
//Input
int a,b;
cin >> a >> b;
char arrA[10];
char arrB[10];
for (int i = 0; i < a; i++){
cin >> arrA[i];
}
for (int i = 0; i < b; i++){
cin >> arrB[i];
}
//ScoreA
int scoreA = 0;
int AaceCount = 0;
for (int i = 0; i < a; i++){
if (arrA[i] == 'A'){
AaceCount += 1;
} else if (arrA[i] == '2'){
scoreA += 2;
} else if (arrA[i] == '3'){
scoreA += 3;
} else if (arrA[i] == '4'){
scoreA += 4;
} else if (arrA[i] == '5'){
scoreA += 5;
} else if (arrA[i] == '6'){
scoreA += 6;
} else if (arrA[i] == '7'){
scoreA += 7;
} else if (arrA[i] == '8'){
scoreA += 8;
} else if (arrA[i] == '9'){
scoreA += 9;
} else if (arrA[i] == '1' || arrA[i] == 'J' || arrA[i] == 'Q'|| arrA[i] == 'K'){
scoreA += 10;
}
}
if (scoreA >= 21){
scoreA += AaceCount;
} else {
while (scoreA < 21 && AaceCount > 0){
if (21-scoreA >= 11){
scoreA += 11;
AaceCount -= 1;
} else {
scoreA += 1;
AaceCount -= 1;
}
}
if (scoreA >= 21 && AaceCount > 0){
scoreA += AaceCount;
}
}
//ScoreB
int scoreB = 0;
int BaceCount = 0;
for (int i = 0; i < b; i++){
if (arrB[i] == 'A'){
BaceCount += 1;
} else if (arrB[i] == '2'){
scoreB += 2;
} else if (arrB[i] == '3'){
scoreB += 3;
} else if (arrB[i] == '4'){
scoreB += 4;
} else if (arrB[i] == '5'){
scoreB += 5;
} else if (arrB[i] == '6'){
scoreB += 6;
} else if (arrB[i] == '7'){
scoreB += 7;
} else if (arrB[i] == '8'){
scoreB += 8;
} else if (arrB[i] == '9'){
scoreB += 9;
} else if (arrB[i] == '1' || arrB[i] == 'J' || arrB[i] == 'Q'|| arrB[i] == 'K'){
scoreB += 10;
}
}
if (scoreB >= 21){
scoreB += BaceCount;
} else {
while (scoreB < 21 && BaceCount > 0){
if (21-scoreB >= 11){
scoreB += 11;
BaceCount -= 1;
} else {
scoreB += 1;
BaceCount -= 1;
}
}
if (scoreB >= 21 && BaceCount > 0){
scoreB += BaceCount;
}
}
//Win-Lose
if (scoreA > 21 && scoreB <= 21){
cout << "B" << endl;
cout << scoreA << " " << scoreB;
} else if (scoreB > 21 && scoreA <= 21){
cout << "A" << endl;
cout << scoreA << " " << scoreB;
} else if (scoreA > 21 && scoreB > 21){
cout << "Draw" << endl;
cout << scoreA << " " << scoreB;
} else if (scoreA <= 21 && scoreB <= 21){
if (scoreA > scoreB){
cout << "A" << endl;
cout << scoreA << " " << scoreB;
} else if (scoreB > scoreA){
cout << "B" << endl;
cout << scoreA << " " << scoreB;
} else if (scoreA == scoreB){
cout << "Draw" << endl;
cout << scoreA << " " << scoreB;
}
}
} |
# 2017092, 2024-09-28 12:54:56, PPPPP--------------- (25%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0;
cin>>a>>b;
string A[a],B[b];
for(int i=0;i<a;i++){cin>>A[i];}
for(int i=0;i<b;i++){cin>>B[i];}
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pie[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
for(int j=0;j<12;j++){
if(A[i]==pie[j]){suma+=score[j];}
if(A[i]=="A"){
if(suma+11>21){suma+=1;}
else{suma+=11;}
}
}
}
for(int i=0;i<b;i++){
for(int j=0;j<12;j++){
if(B[i]==pie[j]){sumb+=score[j];}
if(B[i]=="A"){
if(sumb+11>21){sumb+=1;}
else{sumb+=11;}
}
}
}
if(suma>sumb){cout<<"A"<<endl<<suma<<" "<<sumb;}
else if(suma<sumb){cout<<"B"<<endl<<suma<<" "<<sumb;}
else{cout<<"Draw"<<endl<<suma<<" "<<sumb;}
} | # 2017129, 2024-09-28 12:59:01, PPPPP---P-----P---P- (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0;
cin>>a>>b;
string A[a],B[b];
for(int i=0;i<a;i++){cin>>A[i];}
for(int i=0;i<b;i++){cin>>B[i];}
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pie[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
for(int j=0;j<12;j++){
if(A[i]==pie[j]){suma+=score[j];}
}
if(A[i]=="A"){
if(suma+11>21){suma+=1;}
else if(suma+11<=21){suma+=11;}
}
}
for(int i=0;i<b;i++){
for(int j=0;j<12;j++){
if(B[i]==pie[j]){sumb+=score[j];}
}
if(B[i]=="A"){
if(sumb+11>21){sumb+=1;}
else if(sumb+11<=21){sumb+=11;}
}
}
if(suma>sumb){cout<<"A"<<endl<<suma<<" "<<sumb;}
else if(suma<sumb){cout<<"B"<<endl<<suma<<" "<<sumb;}
else{cout<<"Draw"<<endl<<suma<<" "<<sumb;}
} | # 2018003, 2024-09-28 14:24:04, PPPP--P-P---P-P--PP- (50%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0;
cin>>a>>b;
string A[a],B[b];
for(int i=0;i<a;i++){cin>>A[i];}
for(int i=0;i<b;i++){cin>>B[i];}
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pie[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
for(int j=0;j<12;j++){
if(A[i]==pie[j]){suma+=score[j];}
}
if(A[i]=="A"){
if(suma+11>21){suma+=1;}
else if(suma+11<=21){suma+=11;}
}
}
for(int i=0;i<b;i++){
for(int j=0;j<12;j++){
if(B[i]==pie[j]){sumb+=score[j];}
}
if(B[i]=="A"){
sumb+=11;
if(sumb>21){sumb=sumb-11+1;}
}
}
if(suma>sumb||sumb>21){cout<<"A"<<endl<<suma<<" "<<sumb;}
else if(suma<sumb||suma>21){cout<<"B"<<endl<<suma<<" "<<sumb;}
else{cout<<"Draw"<<endl<<suma<<" "<<sumb;}
} | # 2018082, 2024-09-28 14:31:39, PPPP--P-P---P-P--PP- (50%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0;
cin>>a>>b;
string A[a],B[b];
for(int i=0;i<a;i++){cin>>A[i];}
for(int i=0;i<b;i++){cin>>B[i];}
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pie[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
for(int i=0;i<a;i++){
for(int j=0;j<12;j++){
if(A[i]==pie[j]){suma+=score[j];}
}
if(A[i]=="A"){
if(suma+11>21){suma+=1;}
else if(suma+11<=21){suma+=11;}
}
}
for(int i=0;i<b;i++){
for(int j=0;j<12;j++){
if(B[i]==pie[j]){sumb+=score[j];}
}
if(B[i]=="A"){
sumb+=11;
if(sumb>21){sumb=sumb-11; sumb=sumb+1;}
}
}
if(suma>sumb||sumb>21){cout<<"A"<<endl<<suma<<" "<<sumb;}
else if(suma<sumb||suma>21){cout<<"B"<<endl<<suma<<" "<<sumb;}
else if(suma>21&&sumb>21){cout<<"Draw"<<endl<<suma<<" "<<sumb;}
else{cout<<"Draw"<<endl<<suma<<" "<<sumb;}
} | # 2018787, 2024-09-28 15:18:48, PPPP--P-P---P-P--P-- (45%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0;
cin>>a>>b;
string A[a],B[b];
for(int i=0;i<a;i++){cin>>A[i];}
for(int i=0;i<b;i++){cin>>B[i];}
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pie[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int pa[2]={1,11};
for(int i=0;i<a;i++){
if(A[i]=="A"){
if(suma+11>21){suma+=1;}
else if(suma+11<=21){suma+=11;}
}
for(int j=0;j<12;j++){
if(A[i]==pie[j]){suma+=score[j];}
}
}
for(int i=0;i<b;i++){
if(B[i]=="A"){
sumb+=11;
if(sumb>21){sumb=sumb-11-score[i-1]; sumb+=1;}
}
for(int j=0;j<12;j++){
if(B[i]==pie[j]){sumb+=score[j];}
}
}
if(suma>sumb||sumb>21){cout<<"A"<<endl<<suma<<" "<<sumb;}
else if(suma<sumb||suma>21){cout<<"B"<<endl<<suma<<" "<<sumb;}
else if(suma>21&&sumb>21){cout<<"Draw"<<endl<<suma<<" "<<sumb;}
else{cout<<"Draw"<<endl<<suma<<" "<<sumb;}
} | # 2018815, 2024-09-28 15:19:30, PPPP--P-P---P-P--P-- (45%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,suma=0,sumb=0;
cin>>a>>b;
string A[a],B[b];
for(int i=0;i<a;i++){cin>>A[i];}
for(int i=0;i<b;i++){cin>>B[i];}
int score[12]={2,3,4,5,6,7,8,9,10,10,10,10};
string pie[12]={"2","3","4","5","6","7","8","9","10","J","Q","K"};
int pa[2]={1,11};
for(int i=0;i<a;i++){
if(A[i]=="A"){
if(suma+11>21){suma+=1;}
else if(suma+11<=21){suma+=11;}
}
for(int j=0;j<12;j++){
if(A[i]==pie[j]){suma+=score[j];}
}
}
for(int i=0;i<b;i++){
if(B[i]=="A"){
if(sumb+11>21){sumb=sumb-10;}
else{sumb+=pa[1];}
}
for(int j=0;j<12;j++){
if(B[i]==pie[j]){sumb+=score[j];}
}
}
if(suma>sumb||sumb>21){cout<<"A"<<endl<<suma<<" "<<sumb;}
else if(suma<sumb||suma>21){cout<<"B"<<endl<<suma<<" "<<sumb;}
else if(suma>21&&sumb>21){cout<<"Draw"<<endl<<suma<<" "<<sumb;}
else{cout<<"Draw"<<endl<<suma<<" "<<sumb;}
} |
# 2017562, 2024-09-28 13:42:14, PP--P--Pxxxxxxxxxxxx (20%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
sumx = sumx + (stoi(x[i]));
// if(sumx < 10){
// if(x[i]=="A"){
// sumx=sumx+10;
// }
// }
// else{
// if(x[i]=="A"){
// sumx=sumx+1;
// }
// }
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017583, 2024-09-28 13:45:47, PP--P--PP----------- (25%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="11";
}
sumx = sumx + (stoi(x[i]));
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="11";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017584, 2024-09-28 13:46:00, PP--P--PP----------- (25%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="11";
}
sumx = sumx + (stoi(x[i]));
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="1";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017587, 2024-09-28 13:46:15, PP--P--P-P---------- (25%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="1";
}
sumx = sumx + (stoi(x[i]));
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="11";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017807, 2024-09-28 14:07:44, PP--PPPPP----------- (35%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="11";
}
sumx = sumx + (stoi(x[i]));
// cout<<stoi(x[i])<<" ";
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="11";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
else if(sumx<=21 && sumy >21){
result="A";
}
else if(sumx>21 && sumy<=21){
result="B";
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017982, 2024-09-28 14:22:34, PP--PPPP-P-P-------- (40%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="1";
}
sumx = sumx + (stoi(x[i]));
// cout<<stoi(x[i])<<" ";
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="11";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
else if(sumx<=21 && sumy >21){
result="A";
}
else if(sumx>21 && sumy<=21){
result="B";
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017984, 2024-09-28 14:22:45, PP--PPPP--PP-------- (40%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="1";
}
sumx = sumx + (stoi(x[i]));
// cout<<stoi(x[i])<<" ";
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="1";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
else if(sumx<=21 && sumy >21){
result="A";
}
else if(sumx>21 && sumy<=21){
result="B";
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017989, 2024-09-28 14:23:24, PP--PPPPP----------- (35%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="11";
}
sumx = sumx + (stoi(x[i]));
// cout<<stoi(x[i])<<" ";
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="1";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
else if(sumx<=21 && sumy >21){
result="A";
}
else if(sumx>21 && sumy<=21){
result="B";
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2017996, 2024-09-28 14:23:42, PP--PPPP-P-P-------- (40%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="1";
}
sumx = sumx + (stoi(x[i]));
// cout<<stoi(x[i])<<" ";
}
for(int i=0;i<b;i++){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="11";
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
else if(sumx<=21 && sumy >21){
result="A";
}
else if(sumx>21 && sumy<=21){
result="B";
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} | # 2018829, 2024-09-28 15:19:49, PP--xPPxPxxxxxxxxxPx (30%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int sumx=0, sumy=0;
int a, b;
string result;
cin>>a>>b;
string x[a], y[b];
for(int i=0;i<a;i++){
cin>>x[i];
}
for(int i=0;i<b;i++){
cin>>y[i];
}
for(int i=0;i<a;i++){
if(sumx<11){
if(x[i]=="J"){
x[i]="10";
}
else if(x[i]=="Q"){
x[i]="10";
}
else if(x[i]=="K"){
x[i]="10";
}
else if(x[i]=="A"){
x[i]="11";
}
}
else{
if(x[i]=="A"){
x[i]=="1";
}
}
sumx = sumx + (stoi(x[i]));
}
for(int i=0;i<b;i++){
if(sumy<11){
if(y[i]=="J"){
y[i]="10";
}
else if(y[i]=="Q"){
y[i]="10";
}
else if(y[i]=="K"){
y[i]="10";
}
else if(y[i]=="A"){
y[i]="11";
}
}
else{
if(y[i]=="A"){
y[i]="1";
}
}
sumy=sumy+ (stoi(y[i]));
}
if(sumx >21 && sumy>21){
result="Draw";
}
else if(sumx<=21 && sumy <=21){
if(sumx>sumy){
result="A";
}
else{
result="B";
}
}
else if(sumx<=21 && sumy >21){
result="A";
}
else if(sumx>21 && sumy<=21){
result="B";
}
cout<<result<<endl;
cout<<sumx<<" "<<sumy;
} |
# 2018097, 2024-09-28 14:33:27, PPPP-P--P----------- (30%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
string a[A], b[B];
for(int i=0;i<A;i++){
cin >> a[i];
}
for(int i=0;i<B;i++){
cin >> b[i];
}
int sumA=0;
bool winA=true;
for(int i=0;i<A;i++){
if(a[i]=="2"){
sumA+=2;
}else if(a[i]=="A"){
sumA+=11;
}else if(a[i]=="J"){
sumA+=10;
}else if(a[i]=="Q"){
sumA+=10;
}else if(a[i]=="K"){
sumA+=10;
}else if(a[i]=="3"){
sumA+=3;
}else if(a[i]=="4"){
sumA+=4;
}else if(a[i]=="5"){
sumA+=5;
}else if(a[i]=="6"){
sumA+=6;
}else if(a[i]=="7"){
sumA+=7;
}else if(a[i]=="8"){
sumA+=8;
}else if(a[i]=="9"){
sumA+=9;
}else if(a[i]=="10"){
sumA+=10;
}
}
if(sumA>21) winA -=10;
if(sumA>21) winA = false;
int sumB=0;
bool winB=true;
for(int i=0;i<B;i++){
if(b[i]=="2"){
sumB+=2;
}else if(b[i]=="A"){
sumB+=11;
}else if(b[i]=="J"){
sumB+=10;
}else if(b[i]=="Q"){
sumB+=10;
}else if(b[i]=="K"){
sumB+=10;
}else if(b[i]=="3"){
sumB+=3;
}else if(b[i]=="4"){
sumB+=4;
}else if(b[i]=="5"){
sumB+=5;
}else if(b[i]=="6"){
sumB+=6;
}else if(b[i]=="7"){
sumB+=7;
}else if(b[i]=="8"){
sumB+=8;
}else if(b[i]=="9"){
sumB+=9;
}else if(b[i]=="10"){
sumB+=10;
}
}
if(sumB>21) sumB-=10;
if(sumA>21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumA>21 && sumB>21){
cout << "Draw" << endl << sumA << " " << sumB;
}else if(sumA>sumB && winA){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumB>sumA && winB){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumA==sumB){
cout << "Draw" << endl << sumA << " " << sumB;
}
} | # 2018140, 2024-09-28 14:37:36, PPPP-P--P----------- (30%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
string a[A], b[B];
for(int i=0;i<A;i++){
cin >> a[i];
}
for(int i=0;i<B;i++){
cin >> b[i];
}
int sumA=0;
bool winA=true;
for(int i=0;i<A;i++){
if(a[i]=="2"){
sumA+=2;
}else if(a[i]=="A"){
sumA+=11;
}else if(a[i]=="J"){
sumA+=10;
}else if(a[i]=="Q"){
sumA+=10;
}else if(a[i]=="K"){
sumA+=10;
}else if(a[i]=="3"){
sumA+=3;
}else if(a[i]=="4"){
sumA+=4;
}else if(a[i]=="5"){
sumA+=5;
}else if(a[i]=="6"){
sumA+=6;
}else if(a[i]=="7"){
sumA+=7;
}else if(a[i]=="8"){
sumA+=8;
}else if(a[i]=="9"){
sumA+=9;
}else if(a[i]=="10"){
sumA+=10;
}
}
if(sumA>21) winA -=10;
if(sumA>21) winA = false;
int sumB=0;
bool winB=true;
for(int i=0;i<B;i++){
if(b[i]=="2"){
sumB+=2;
}else if(b[i]=="A"){
sumB+=11;
}else if(b[i]=="J"){
sumB+=10;
}else if(b[i]=="Q"){
sumB+=10;
}else if(b[i]=="K"){
sumB+=10;
}else if(b[i]=="3"){
sumB+=3;
}else if(b[i]=="4"){
sumB+=4;
}else if(b[i]=="5"){
sumB+=5;
}else if(b[i]=="6"){
sumB+=6;
}else if(b[i]=="7"){
sumB+=7;
}else if(b[i]=="8"){
sumB+=8;
}else if(b[i]=="9"){
sumB+=9;
}else if(b[i]=="10"){
sumB+=10;
}
}
if(sumB>21) sumB-=10;
if(sumA>21 && sumB<21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21 && sumA<21){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumA>21 && sumB>21){
cout << "Draw" << endl << sumA << " " << sumB;
}else if(sumA>sumB && winB){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumB>sumA && winA){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumA==sumB){
cout << "Draw" << endl << sumA << " " << sumB;
}
} | # 2018162, 2024-09-28 14:39:38, PPPP-P--P---------P- (35%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
string a[A], b[B];
for(int i=0;i<A;i++){
cin >> a[i];
}
for(int i=0;i<B;i++){
cin >> b[i];
}
int sumA=0;
bool winA=true;
for(int i=0;i<A;i++){
if(a[i]=="2"){
sumA+=2;
}else if(a[i]=="A"){
sumA+=11;
}else if(a[i]=="J"){
sumA+=10;
}else if(a[i]=="Q"){
sumA+=10;
}else if(a[i]=="K"){
sumA+=10;
}else if(a[i]=="3"){
sumA+=3;
}else if(a[i]=="4"){
sumA+=4;
}else if(a[i]=="5"){
sumA+=5;
}else if(a[i]=="6"){
sumA+=6;
}else if(a[i]=="7"){
sumA+=7;
}else if(a[i]=="8"){
sumA+=8;
}else if(a[i]=="9"){
sumA+=9;
}else if(a[i]=="10"){
sumA+=10;
}
}
if(sumA>21) winA -=10;
if(sumA>21) winA -=10;
if(sumA>21) winA = false;
int sumB=0;
bool winB=true;
for(int i=0;i<B;i++){
if(b[i]=="2"){
sumB+=2;
}else if(b[i]=="A"){
sumB+=11;
}else if(b[i]=="J"){
sumB+=10;
}else if(b[i]=="Q"){
sumB+=10;
}else if(b[i]=="K"){
sumB+=10;
}else if(b[i]=="3"){
sumB+=3;
}else if(b[i]=="4"){
sumB+=4;
}else if(b[i]=="5"){
sumB+=5;
}else if(b[i]=="6"){
sumB+=6;
}else if(b[i]=="7"){
sumB+=7;
}else if(b[i]=="8"){
sumB+=8;
}else if(b[i]=="9"){
sumB+=9;
}else if(b[i]=="10"){
sumB+=10;
}
}
if(sumB>21) sumB-=10;
if(sumB>21) sumB-=10;
if(sumA>21 && sumB<21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21 && sumA<21){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumA>21 && sumB>21){
cout << "Draw" << endl << sumA << " " << sumB;
}else if(sumA>sumB && winB){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumB>sumA && winA){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumA==sumB){
cout << "Draw" << endl << sumA << " " << sumB;
}
} | # 2018179, 2024-09-28 14:41:24, PPPP-P--P---------P- (35%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
string a[A], b[B];
for(int i=0;i<A;i++){
cin >> a[i];
}
for(int i=0;i<B;i++){
cin >> b[i];
}
int sumA=0;
bool winA=true;
for(int i=0;i<A;i++){
if(a[i]=="2"){
sumA+=2;
}else if(a[i]=="A"){
sumA+=11;
}else if(a[i]=="J"){
sumA+=10;
}else if(a[i]=="Q"){
sumA+=10;
}else if(a[i]=="K"){
sumA+=10;
}else if(a[i]=="3"){
sumA+=3;
}else if(a[i]=="4"){
sumA+=4;
}else if(a[i]=="5"){
sumA+=5;
}else if(a[i]=="6"){
sumA+=6;
}else if(a[i]=="7"){
sumA+=7;
}else if(a[i]=="8"){
sumA+=8;
}else if(a[i]=="9"){
sumA+=9;
}else if(a[i]=="10"){
sumA+=10;
}
}
if(sumA>21) winA -=10;
if(sumA>21) winA -=10;
if(sumA>21) winA -=10;
if(sumA>21) winA = false;
int sumB=0;
bool winB=true;
for(int i=0;i<B;i++){
if(b[i]=="2"){
sumB+=2;
}else if(b[i]=="A"){
sumB+=11;
}else if(b[i]=="J"){
sumB+=10;
}else if(b[i]=="Q"){
sumB+=10;
}else if(b[i]=="K"){
sumB+=10;
}else if(b[i]=="3"){
sumB+=3;
}else if(b[i]=="4"){
sumB+=4;
}else if(b[i]=="5"){
sumB+=5;
}else if(b[i]=="6"){
sumB+=6;
}else if(b[i]=="7"){
sumB+=7;
}else if(b[i]=="8"){
sumB+=8;
}else if(b[i]=="9"){
sumB+=9;
}else if(b[i]=="10"){
sumB+=10;
}
}
if(sumB>21) sumB-=10;
if(sumB>21) sumB-=10;
if(sumA>21 && sumB<21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21 && sumA<21){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumA>21 && sumB>21){
cout << "Draw" << endl << sumA << " " << sumB;
}else if(sumA>sumB && winB){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumB>sumA && winA){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumA==sumB){
cout << "Draw" << endl << sumA << " " << sumB;
}
} | # 2018235, 2024-09-28 14:45:11, PPPP----P----------- (25%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
string a[A], b[B];
for(int i=0;i<A;i++){
cin >> a[i];
}
for(int i=0;i<B;i++){
cin >> b[i];
}
int sumA=0;
bool winA=true;
for(int i=0;i<A;i++){
if(a[i]=="2"){
sumA+=2;
}else if(a[i]=="A"){
sumA+=11;
}else if(a[i]=="J"){
sumA+=10;
}else if(a[i]=="Q"){
sumA+=10;
}else if(a[i]=="K"){
sumA+=10;
}else if(a[i]=="3"){
sumA+=3;
}else if(a[i]=="4"){
sumA+=4;
}else if(a[i]=="5"){
sumA+=5;
}else if(a[i]=="6"){
sumA+=6;
}else if(a[i]=="7"){
sumA+=7;
}else if(a[i]=="8"){
sumA+=8;
}else if(a[i]=="9"){
sumA+=9;
}else if(a[i]=="10"){
sumA+=10;
}
}
if(sumA>21) winA = false;
int sumB=0;
bool winB=true;
for(int i=0;i<B;i++){
if(b[i]=="2"){
sumB+=2;
}else if(b[i]=="A"){
sumB+=11;
}else if(b[i]=="J"){
sumB+=10;
}else if(b[i]=="Q"){
sumB+=10;
}else if(b[i]=="K"){
sumB+=10;
}else if(b[i]=="3"){
sumB+=3;
}else if(b[i]=="4"){
sumB+=4;
}else if(b[i]=="5"){
sumB+=5;
}else if(b[i]=="6"){
sumB+=6;
}else if(b[i]=="7"){
sumB+=7;
}else if(b[i]=="8"){
sumB+=8;
}else if(b[i]=="9"){
sumB+=9;
}else if(b[i]=="10"){
sumB+=10;
}
}
if(sumA>21 && sumB<21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21 && sumA<21){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumA>21 && sumB>21){
cout << "Draw" << endl << sumA << " " << sumB;
}
if(sumA>21) winA -=10;
if(sumB>21) sumB-=10;
if(sumA>sumB && winB){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumB>sumA && winA){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumA==sumB){
cout << "Draw" << endl << sumA << " " << sumB;
}
} | # 2018239, 2024-09-28 14:45:26, PPPP-P--P---------P- (35%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
string a[A], b[B];
for(int i=0;i<A;i++){
cin >> a[i];
}
for(int i=0;i<B;i++){
cin >> b[i];
}
int sumA=0;
bool winA=true;
for(int i=0;i<A;i++){
if(a[i]=="2"){
sumA+=2;
}else if(a[i]=="A"){
sumA+=11;
}else if(a[i]=="J"){
sumA+=10;
}else if(a[i]=="Q"){
sumA+=10;
}else if(a[i]=="K"){
sumA+=10;
}else if(a[i]=="3"){
sumA+=3;
}else if(a[i]=="4"){
sumA+=4;
}else if(a[i]=="5"){
sumA+=5;
}else if(a[i]=="6"){
sumA+=6;
}else if(a[i]=="7"){
sumA+=7;
}else if(a[i]=="8"){
sumA+=8;
}else if(a[i]=="9"){
sumA+=9;
}else if(a[i]=="10"){
sumA+=10;
}
}
if(sumA>21) winA -=10;
if(sumA>21) winA -=10;
if(sumA>21) winA -=10;
if(sumA>21) winA = false;
int sumB=0;
bool winB=true;
for(int i=0;i<B;i++){
if(b[i]=="2"){
sumB+=2;
}else if(b[i]=="A"){
sumB+=11;
}else if(b[i]=="J"){
sumB+=10;
}else if(b[i]=="Q"){
sumB+=10;
}else if(b[i]=="K"){
sumB+=10;
}else if(b[i]=="3"){
sumB+=3;
}else if(b[i]=="4"){
sumB+=4;
}else if(b[i]=="5"){
sumB+=5;
}else if(b[i]=="6"){
sumB+=6;
}else if(b[i]=="7"){
sumB+=7;
}else if(b[i]=="8"){
sumB+=8;
}else if(b[i]=="9"){
sumB+=9;
}else if(b[i]=="10"){
sumB+=10;
}
}
if(sumB>21) sumB-=10;
if(sumB>21) sumB-=10;
if(sumA>21 && sumB<21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21 && sumA<21){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumA>21 && sumB>21){
cout << "Draw" << endl << sumA << " " << sumB;
}else if(sumA>sumB && winB){
cout << "A" << endl << sumA << " " << sumB;
}else if(sumB>sumA && winA){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumA==sumB){
cout << "Draw" << endl << sumA << " " << sumB;
}
} |
# 2015846, 2024-09-28 10:49:00, PPPP-P-------------- (25%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
string N_A[a];
string N_B[b];
for(int i=0;i<a;++i){
cin>>N_A[i];
}
for(int i=0;i<b;++i){
cin>>N_B[i];
}
//int A[11]={1,2,3,4,5,6,7,8,9,10,11};
string card[12]= {"2","3","4","5","6","7","8","9","10","J","Q","K"};
int point[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
int sumA = 0;
int sumB = 0;
//N_A
for(int i=0;i<a;++i){
for(int j=0;j<12;++j){
if(N_A[i]==card[j]){
sumA += point[j];
}
}
}
//N_B
for(int i=0;i<b;++i){
for(int j=0;j<12;++j){
if(N_B[i]==card[j]){
sumB += point[j];
}
}
}
if(sumA>21){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumB>21){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA>sumB){
cout<<"A"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA<sumB){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else {
cout<<"Draw"<<endl;
cout<<sumA<<" "<<sumB;
}
} | # 2015872, 2024-09-28 10:52:34, PP--P--P------------ (20%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
string N_A[a];
string N_B[b];
for(int i=0;i<a;++i){
cin>>N_A[i];
}
for(int i=0;i<b;++i){
cin>>N_B[i];
}
//int A[11]={1,2,3,4,5,6,7,8,9,10,11};
string card[12]= {"2","3","4","5","6","7","8","9","10","J","Q","K"};
int point[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
int sumA = 0;
int sumB = 0;
//N_A
for(int i=0;i<a;++i){
for(int j=0;j<12;++j){
if(N_A[i]==card[j]){
sumA += point[j];
}
}
}
//N_B
for(int i=0;i<b;++i){
for(int j=0;j<12;++j){
if(N_B[i]==card[j]){
sumB += point[j];
}
}
}
if(sumA>21||sumB>21||(sumA>21&&sumB>21)){
cout<<"Draw"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA>sumB){
cout<<"A"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA<sumB){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}
} | # 2015897, 2024-09-28 10:54:57, PP--PPPP------------ (30%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
string N_A[a];
string N_B[b];
for(int i=0;i<a;++i){
cin>>N_A[i];
}
for(int i=0;i<b;++i){
cin>>N_B[i];
}
//int A[11]={1,2,3,4,5,6,7,8,9,10,11};
string card[12]= {"2","3","4","5","6","7","8","9","10","J","Q","K"};
int point[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
int sumA = 0;
int sumB = 0;
//N_A
for(int i=0;i<a;++i){
for(int j=0;j<12;++j){
if(N_A[i]==card[j]){
sumA += point[j];
}
}
}
//N_B
for(int i=0;i<b;++i){
for(int j=0;j<12;++j){
if(N_B[i]==card[j]){
sumB += point[j];
}
}
}
if((sumA>21&&sumB>21)){
cout<<"Draw"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumB>21){
cout<<"A"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA>21){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA<sumB){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA>sumB){
cout<<"A"<<endl;
cout<<sumA<<" "<<sumB;
}
} | # 2016010, 2024-09-28 11:03:34, PP--PPPPP----------- (35%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
string N_A[a];
string N_B[b];
for(int i=0;i<a;++i){
cin>>N_A[i];
}
for(int i=0;i<b;++i){
cin>>N_B[i];
}
int A[11]={1,2,3,4,5,6,7,8,9,10,11};
string card[12]= {"2","3","4","5","6","7","8","9","10","J","Q","K"};
int point[12] = {2,3,4,5,6,7,8,9,10,10,10,10};
int sumA = 0;
int sumB = 0;
//N_A
for(int i=0;i<a;++i){
for(int j=0;j<12;++j){
if(N_A[i]=="A"){
sumA = 21;
break;
}else if(N_A[i]==card[j]){
sumA += point[j];
}
}
}
//N_B
for(int i=0;i<b;++i){
for(int j=0;j<12;++j){
if(N_B[i]=="A"){
sumB = 21;
break;
}else if(N_B[i]==card[j]){
sumB += point[j];
}
}
}
if((sumA>21&&sumB>21)){
cout<<"Draw"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumB>21){
cout<<"A"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA>21){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA<sumB){
cout<<"B"<<endl;
cout<<sumA<<" "<<sumB;
}else if(sumA>sumB){
cout<<"A"<<endl;
cout<<sumA<<" "<<sumB;
}
} |
# 2016489, 2024-09-28 11:45:13, --PPP-P------------- (20%)
#include <iostream>
using namespace std;
int main(){
int a,b;
char A,B;
int cnta=0;
int cntb=0;
cin >>a>>b;
/*for(int j=0;j<b;j++){
cin>>B[j];
}
if(A[0]=='A'||A[1]=='A'||A[2]=='A'){
}*/
while(a--){
cin>>A;
if(A=='A'){
if(cnta>11){
cnta+=1;
}else{
cnta+=11;
}
}else if(A=='2'){
cnta+=2;
}else if(A=='3'){
cnta+=3;
}else if(A=='4'){
cnta+=4;
}else if(A=='5'){
cnta+=5;
}else if(A=='6'){
cnta+=6;
}else if(A=='7'){
cnta+=7;
}else if(A=='8'){
cnta+=8;
}else if(A=='9'){
cnta+=9;
}else if(A=='1'){
cnta+=10;
}else if(A=='J'){
cnta+=10;
}else if(A=='Q'){
cnta+=10;
}else if(A=='K'){
cnta+=10;
}
}
while(b--){
cin>>B;
if(B=='A'){
if(cntb>11){
cntb+=1;
}else{
cntb+=11;
}
}else if(B=='2'){
cntb+=2;
}else if(B=='3'){
cntb+=3;
}else if(B=='4'){
cntb+=4;
}else if(B=='5'){
cntb+=5;
}else if(B=='6'){
cntb+=6;
}else if(B=='7'){
cntb+=7;
}else if(B=='8'){
cntb+=8;
}else if(B=='9'){
cntb+=9;
}else if(B=='1'){
cntb+=10;
}else if(B=='J'){
cntb+=10;
}else if(B=='Q'){
cntb+=10;
}else if(B=='K'){
cntb+=10;
}
}
if(cnta>21&&cntb>21){
cout<<"Draw"<<"\n";
}else{
if(abs(cnta-21)>abs(cntb-21)){
cout<<"A"<<"\n";
}else if(abs(cnta-21)<abs(cntb-21)){
cout<<"B"<<"\n";
}else{
cout<<"Draw"<<"\n";
}
}
cout<<cnta<<" "<<cntb;
} | # 2016584, 2024-09-28 11:51:11, P-PPP--------------- (20%)
#include <iostream>
using namespace std;
int main(){
int a,b;
char A,B;
int cnta=0;
int cntb=0;
cin >>a>>b;
/*for(int j=0;j<b;j++){
cin>>B[j];
}
if(A[0]=='A'||A[1]=='A'||A[2]=='A'){
}*/
while(a--){
cin>>A;
if(A=='A'){
if(cnta>11){
cnta+=1;
}else{
cnta+=11;
}
}else if(A=='2'){
cnta+=2;
}else if(A=='3'){
cnta+=3;
}else if(A=='4'){
cnta+=4;
}else if(A=='5'){
cnta+=5;
}else if(A=='6'){
cnta+=6;
}else if(A=='7'){
cnta+=7;
}else if(A=='8'){
cnta+=8;
}else if(A=='9'){
cnta+=9;
}else if(A=='1'){
cnta+=10;
}else if(A=='J'){
cnta+=10;
}else if(A=='Q'){
cnta+=10;
}else if(A=='K'){
cnta+=10;
}
}
while(b--){
cin>>B;
if(B=='A'){
if(cntb>11){
cntb+=1;
}else{
cntb+=11;
}
}else if(B=='2'){
cntb+=2;
}else if(B=='3'){
cntb+=3;
}else if(B=='4'){
cntb+=4;
}else if(B=='5'){
cntb+=5;
}else if(B=='6'){
cntb+=6;
}else if(B=='7'){
cntb+=7;
}else if(B=='8'){
cntb+=8;
}else if(B=='9'){
cntb+=9;
}else if(B=='1'){
cntb+=10;
}else if(B=='J'){
cntb+=10;
}else if(B=='Q'){
cntb+=10;
}else if(B=='K'){
cntb+=10;
}
}
if(cnta>21&&cntb>21){
cout<<"Draw"<<"\n";
}else{
if(abs(cnta-21)<abs(cntb-21)){
cout<<"A"<<"\n";
}else if(abs(cnta-21)>abs(cntb-21)){
cout<<"B"<<"\n";
}else{
cout<<"Draw"<<"\n";
}
}
cout<<cnta<<" "<<cntb;
} |
# 2016015, 2024-09-28 11:04:07, P-P----------------- (10%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int na,nb,suma=0,sumb=0;
cin >> na >> nb;
int a[na],b[nb];
int a2[na],b2[nb];
for(int i=0;i<na;i++){
cin >> a[i];
// for(int j=0;j<na;j++){
// if(a[i] == "A"){
// a2[j] = 1;
// } else if(a[i] == "J"){
// a2[j] = 10;
// } else if(a[i] == "Q"){
// a2[j] = 10;
// } else if(a[i] == "K"){
// a2[j] = 10;
// }
// cout << a2[j] << " ";
// }
suma += a[i];
}
for(int i=0;i<nb;i++){
cin >> b[i];
sumb += b[i];
}
if(suma > sumb){
cout << "A" << endl;
cout << suma << " " << sumb;
} else if(sumb > suma){
cout << "B" << endl;
cout << suma << " " << sumb;
} else if(suma == sumb){
cout << "Draw" << endl;
cout << suma << " " << sumb;
}
} | # 2016054, 2024-09-28 11:08:40, P-P--PP------------- (20%)
#include<iostream>
#include<string>
using namespace std;
int main(){
int na,nb,suma=0,sumb=0;
cin >> na >> nb;
int a[na],b[nb];
int a2[na],b2[nb];
for(int i=0;i<na;i++){
cin >> a[i];
// for(int j=0;j<na;j++){
// if(a[i] == "A"){
// a2[j] = 1;
// } else if(a[i] == "J"){
// a2[j] = 10;
// } else if(a[i] == "Q"){
// a2[j] = 10;
// } else if(a[i] == "K"){
// a2[j] = 10;
// }
// cout << a2[j] << " ";
// }
suma += a[i];
}
for(int i=0;i<nb;i++){
cin >> b[i];
sumb += b[i];
}
if(suma > sumb){
if(suma > 21){
cout << "B" << endl;
cout << suma << " " << sumb;
} else {
cout << "A" << endl;
cout << suma << " " << sumb;
}
} else if(sumb > suma){
if(sumb > 21){
cout << "A" << endl;
cout << suma << " " << sumb;
} else {
cout << "B" << endl;
cout << suma << " " << sumb;
}
} else if(suma == sumb){
cout << "Draw" << endl;
cout << suma << " " << sumb;
}
} |
# 2015814, 2024-09-28 10:45:13, xxxxxxxxxxxxxxxxxxxx (0%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n];
string b[j];
for (int i = 0; i < 2; i++) {
cin >> a[i];
cin >> b[i];
}
int player1 = 0;
for (int i = 0; i < 12; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
}
}
int player2 = 0;
for (int i = 0; i < 12; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (a[i] == "3") {
player2 += 3;
} else if (a[i] == "4") {
player2 +=4;
} else if (a[i] == "5") {
player2 += 5;
} else if (a[i] == "6") {
player2 += 6;
} else if (a[i] == "7") {
player2 += 7;
} else if (a[i] == "8") {
player2 += 8;
}else if (a[i] == "9") {
player2 += 9;
} else if (a[i] == "10") {
player2 += 10;
}else if (a[i] == "J") {
player2 += 10;
}else if (a[i] == "Q") {
player2 += 10;
} else if (a[i] == "K") {
player2 += 10;
}
}
cout << "A";
cout << player1 << player2;
} | # 2016324, 2024-09-28 11:34:17, xxxxxxxxxxxxxxxxxxxx (0%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < n; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < 12; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < 12; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (a[i] == "3") {
player2 += 3;
} else if (a[i] == "4") {
player2 +=4;
} else if (a[i] == "5") {
player2 += 5;
} else if (a[i] == "6") {
player2 += 6;
} else if (a[i] == "7") {
player2 += 7;
} else if (a[i] == "8") {
player2 += 8;
}else if (a[i] == "9") {
player2 += 9;
} else if (a[i] == "10") {
player2 += 10;
}else if (a[i] == "J") {
player2 += 10;
}else if (a[i] == "Q") {
player2 += 10;
} else if (a[i] == "K") {
player2 += 10;
} else {
player1 += 0;
}
}
if (player1 > player2){
cout << "A";
} else if (player2 > player1) {
cout << "B";
} else {
cout << "Draw";
}
cout << player1 << player2;
} | # 2016559, 2024-09-28 11:49:45, --PPP--------------- (15%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < n; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (a[i] == "3") {
player2 += 3;
} else if (a[i] == "4") {
player2 +=4;
} else if (a[i] == "5") {
player2 += 5;
} else if (a[i] == "6") {
player2 += 6;
} else if (a[i] == "7") {
player2 += 7;
} else if (a[i] == "8") {
player2 += 8;
}else if (a[i] == "9") {
player2 += 9;
} else if (a[i] == "10") {
player2 += 10;
}else if (a[i] == "J") {
player2 += 10;
}else if (a[i] == "Q") {
player2 += 10;
} else if (a[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 > player2){
cout << "A" << endl;
} else if (player2 > player1) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} | # 2016582, 2024-09-28 11:50:58, --PPP--------------- (15%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < j; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (a[i] == "3") {
player2 += 3;
} else if (a[i] == "4") {
player2 +=4;
} else if (a[i] == "5") {
player2 += 5;
} else if (a[i] == "6") {
player2 += 6;
} else if (a[i] == "7") {
player2 += 7;
} else if (a[i] == "8") {
player2 += 8;
}else if (a[i] == "9") {
player2 += 9;
} else if (a[i] == "10") {
player2 += 10;
}else if (a[i] == "J") {
player2 += 10;
}else if (a[i] == "Q") {
player2 += 10;
} else if (a[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 > player2){
cout << "A" << endl;
} else if (player2 > player1) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} | # 2016605, 2024-09-28 11:52:25, --PPP-x-----x-x---x- (15%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < j; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (b[i] == "3") {
player2 += 3;
} else if (b[i] == "4") {
player2 +=4;
} else if (b[i] == "5") {
player2 += 5;
} else if (b[i] == "6") {
player2 += 6;
} else if (b[i] == "7") {
player2 += 7;
} else if (b[i] == "8") {
player2 += 8;
}else if (b[i] == "9") {
player2 += 9;
} else if (b[i] == "10") {
player2 += 10;
}else if (b[i] == "J") {
player2 += 10;
}else if (b[i] == "Q") {
player2 += 10;
} else if (b[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 > player2){
cout << "A" << endl;
} else if (player2 > player1) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} | # 2016662, 2024-09-28 11:54:56, --PP--x-----x-x---x- (10%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < j; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (b[i] == "3") {
player2 += 3;
} else if (b[i] == "4") {
player2 +=4;
} else if (b[i] == "5") {
player2 += 5;
} else if (b[i] == "6") {
player2 += 6;
} else if (b[i] == "7") {
player2 += 7;
} else if (b[i] == "8") {
player2 += 8;
}else if (b[i] == "9") {
player2 += 9;
} else if (b[i] == "10") {
player2 += 10;
}else if (b[i] == "J") {
player2 += 10;
}else if (b[i] == "Q") {
player2 += 10;
} else if (b[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 >= 21){
player1 = 0;
}
if (player2 >= 21){
player2 = 0;
}
if (player1 > player2){
cout << "A" << endl;
} else if (player2 > player1) {
cout << "B" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} | # 2016731, 2024-09-28 11:57:55, --PP--x-----x-x---x- (10%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < j; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (b[i] == "3") {
player2 += 3;
} else if (b[i] == "4") {
player2 +=4;
} else if (b[i] == "5") {
player2 += 5;
} else if (b[i] == "6") {
player2 += 6;
} else if (b[i] == "7") {
player2 += 7;
} else if (b[i] == "8") {
player2 += 8;
}else if (b[i] == "9") {
player2 += 9;
} else if (b[i] == "10") {
player2 += 10;
}else if (b[i] == "J") {
player2 += 10;
}else if (b[i] == "Q") {
player2 += 10;
} else if (b[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 > player2){
cout << "A" << endl;
} else if (player2 > player1) {
cout << "B" << endl;
} else if (player1 > 21) {
cout << "B" << endl;
} else if (player1 > 21) {
cout << "A" << endl;
} else if (player1 > 21 && player2 > 21) {
cout << "Draw" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} | # 2016778, 2024-09-28 11:59:11, --PP-Px-----x-x---x- (15%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < j; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (b[i] == "3") {
player2 += 3;
} else if (b[i] == "4") {
player2 +=4;
} else if (b[i] == "5") {
player2 += 5;
} else if (b[i] == "6") {
player2 += 6;
} else if (b[i] == "7") {
player2 += 7;
} else if (b[i] == "8") {
player2 += 8;
}else if (b[i] == "9") {
player2 += 9;
} else if (b[i] == "10") {
player2 += 10;
}else if (b[i] == "J") {
player2 += 10;
}else if (b[i] == "Q") {
player2 += 10;
} else if (b[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 > player2 && player1 <= 21){
cout << "A" << endl;
} else if (player2 > player1 && player2 <= 21) {
cout << "B" << endl;
} else if (player1 > 21) {
cout << "B" << endl;
} else if (player1 > 21) {
cout << "A" << endl;
} else if (player1 > 21 && player2 > 21) {
cout << "Draw" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} | # 2016802, 2024-09-28 11:59:49, --PPP-x-----x-x---x- (15%)
#include <iostream>
using namespace std;
int main() {
int n, j;
cin >> n >> j;
string a[n] = {};
for(int i= 0; i < n; i++){
cin>>a[i];
}
string b[j] = {};
for(int i= 0; i < j; i++){
cin>>b[i];
}
int player1 = 0;
for (int i = 0; i < n; i++) {
if (a[i] == "2") {
player1 += 2;
} else if (a[i] == "3") {
player1 += 3;
} else if (a[i] == "4") {
player1 +=4;
} else if (a[i] == "5") {
player1 += 5;
} else if (a[i] == "6") {
player1 += 6;
} else if (a[i] == "7") {
player1 += 7;
} else if (a[i] == "8") {
player1 += 8;
}else if (a[i] == "9") {
player1 += 9;
} else if (a[i] == "10") {
player1 += 10;
}else if (a[i] == "J") {
player1 += 10;
}else if (a[i] == "Q") {
player1 += 10;
} else if (a[i] == "K") {
player1 += 10;
} else {
player1 += 0;
}
}
int player2 = 0;
for (int i = 0; i < j; i++) {
if (a[i] == "2") {
player2 += 2;
} else if (b[i] == "3") {
player2 += 3;
} else if (b[i] == "4") {
player2 +=4;
} else if (b[i] == "5") {
player2 += 5;
} else if (b[i] == "6") {
player2 += 6;
} else if (b[i] == "7") {
player2 += 7;
} else if (b[i] == "8") {
player2 += 8;
}else if (b[i] == "9") {
player2 += 9;
} else if (b[i] == "10") {
player2 += 10;
}else if (b[i] == "J") {
player2 += 10;
}else if (b[i] == "Q") {
player2 += 10;
} else if (b[i] == "K") {
player2 += 10;
} else {
player2 += 0;
}
}
if (player1 > player2 && player1 <= 21){
cout << "A" << endl;
} else if (player2 > player1 && player2 <= 21) {
cout << "B" << endl;
} else if (player1 > 21 && player2 > 21) {
cout << "Draw" << endl;
} else {
cout << "Draw" << endl;
}
cout << player1 << ' ' << player2;
} |
# 2016149, 2024-09-28 11:18:30, PxP-x-Px-xxx-x------ (15%)
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
string A[a] = {};
string B[b] = {};
string C [12] = {"2", "3", "4", "5", "6", "7", "8", "9", "10" "J", "Q", "K"};
for (int i = 0; i < a; i++) {
cin >> A[i];
}
for (int j = 0; j < b; j++) {
cin >> B[j];
}
int sum1 = 0;
for (int i = 0; i < a; i++) {
for (int k = 0; k < 12; k++) {
if (A[i] == C[k]) {
sum1 += stoi(C[k]);
} else if (A[i] == "J" || A[i] == "Q" || A[i] == "K") {
sum1 += 10;
}
if (A[i] == "A") {
int check = 21 - sum1;
if (check > 1 && check <= 10) {
sum1 += 11;
}
if (check > 10 && check <= 20) {
sum1 += 1;
}
}
}
}
int sum2 = 0;
for (int m = 0; m < b; m++) {
for (int n = 0; n < 12; n++) {
if (B[m] == C[n]) {
sum2 += stoi(C[n]);
} else if (B[m] == "J" || B[m] == "Q" || B[m] == "K") {
sum2 += 10;
}
if (B[m] == "A") {
int check = 21 - sum2;
if (check > 1 && check <= 10) {
sum2 += 11;
}
if (check > 10 && check <= 20) {
sum2 += 1;
}
}
}
}
if (sum1 > 21 && sum2 > 21) {
cout << "Draw" << endl;
} else if (sum1 > 21) {
cout << "B" << endl;
} else if (sum2 > 21) {
cout << "A" << endl;
} else if (sum1 > sum2) {
cout << "A" << endl;
} else if (sum2 > sum1) {
cout << "B" << endl;
} else if (sum1 == sum2) {
cout << "Draw" << endl;
} cout << sum1 << " " << sum2;
} | # 2016752, 2024-09-28 11:58:23, Compilation error (0%)
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
string A[a] = {};
string B[b] = {};
string C [12] = {"2", "3", "4", "5", "6", "7", "8", "9", "10" "J", "Q", "K"};
for (int i = 0; i < a; i++) {
cin >> A[i];
}
for (int j = 0; j < b; j++) {
cin >> B[j];
}
int sum1 = 0;
for (int i = 0; i < a; i++) {
for (int k = 0; k < 12; k++) {
if (A[i] == C[k]) {
sum1 += stoi(C[k]);
}
}
}
}
int sum2 = 0;
for (int m = 0; m < b; m++) {
for (int n = 0; n < 12; n++) {
if (B[m] == C[n]) {
sum2 += stoi(C[n]);
}
}
}
}
if (sum1 > 21 && sum2 > 21) {
cout << "Draw" << endl;
} else if (sum1 > 21) {
cout << "B" << endl;
} else if (sum2 > 21) {
cout << "A" << endl;
} else if (sum1 > sum2) {
cout << "A" << endl;
} else if (sum2 > sum1) {
cout << "B" << endl;
} else if (sum1 == sum2) {
cout << "Draw" << endl;
} cout << sum1 << " " << sum2;
} | # 2016765, 2024-09-28 11:58:50, PxP-x-Px-xxx-x------ (15%)
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
string A[a] = {};
string B[b] = {};
string C [12] = {"2", "3", "4", "5", "6", "7", "8", "9", "10" "J", "Q", "K"};
for (int i = 0; i < a; i++) {
cin >> A[i];
}
for (int j = 0; j < b; j++) {
cin >> B[j];
}
int sum1 = 0;
for (int i = 0; i < a; i++) {
for (int k = 0; k < 12; k++) {
if (A[i] == C[k]) {
sum1 += stoi(C[k]);
} else if (A[i] == "J" || A[i] == "Q" || A[i] == "K") {
sum1 += 10;
}
if (A[i] == "A") {
int check = 21 - sum1;
if (check > 1 && check <= 10) {
sum1 += 11;
}
if (check > 10 && check <= 20) {
sum1 += 1;
}
}
}
}
int sum2 = 0;
for (int m = 0; m < b; m++) {
for (int n = 0; n < 12; n++) {
if (B[m] == C[n]) {
sum2 += stoi(C[n]);
} else if (B[m] == "J" || B[m] == "Q" || B[m] == "K") {
sum2 += 10;
}
if (B[m] == "A") {
int check = 21 - sum2;
if (check > 1 && check <= 10) {
sum2 += 11;
}
if (check > 10 && check <= 20) {
sum2 += 1;
}
}
}
}
if (sum1 > 21 && sum2 > 21) {
cout << "Draw" << endl;
} else if (sum1 > 21) {
cout << "B" << endl;
} else if (sum2 > 21) {
cout << "A" << endl;
} else if (sum1 > sum2) {
cout << "A" << endl;
} else if (sum2 > sum1) {
cout << "B" << endl;
} else if (sum1 == sum2) {
cout << "Draw" << endl;
} cout << sum1 << " " << sum2;
} | # 2016801, 2024-09-28 11:59:48, Compilation error (0%)
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
string A[a] = {};
string B[b] = {};
string C [12] = {"2", "3", "4", "5", "6", "7", "8", "9", "10" "J", "Q", "K"};
for (int i = 0; i < a; i++) {
cin >> A[i];
}
for (int j = 0; j < b; j++) {
cin >> B[j];
}
int sum1 = 0;
for (int i = 0; i < a; i++) {
for (int k = 0; k < 12; k++) {
if (A[i] == C[k]) {
sum1 += stoi(C[k]);
}
}
}
}
int sum2 = 0;
for (int m = 0; m < b; m++) {
for (int n = 0; n < 12; n++) {
if (B[m] == C[n]) {
sum2 += stoi(C[n]);
}
}
}
}
if (sum1 > 21 && sum2 > 21) {
cout << "Draw" << endl;
} else if (sum1 > 21) {
cout << "B" << endl;
} else if (sum2 > 21) {
cout << "A" << endl;
} else if (sum1 > sum2) {
cout << "A" << endl;
} else if (sum2 > sum1) {
cout << "B" << endl;
} else if (sum1 == sum2) {
cout << "Draw" << endl;
} cout << sum1 << " " << sum2;
} | # 2016809, 2024-09-28 11:59:57, PxP-x-Px-xxx-x------ (15%)
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
string A[a] = {};
string B[b] = {};
string C [12] = {"2", "3", "4", "5", "6", "7", "8", "9", "10" "J", "Q", "K"};
for (int i = 0; i < a; i++) {
cin >> A[i];
}
for (int j = 0; j < b; j++) {
cin >> B[j];
}
int sum1 = 0;
for (int i = 0; i < a; i++) {
for (int k = 0; k < 12; k++) {
if (A[i] == C[k]) {
sum1 += stoi(C[k]);
} else if (A[i] == "J" || A[i] == "Q" || A[i] == "K") {
sum1 += 10;
}
if (A[i] == "A") {
int check = 21 - sum1;
if (check > 1 && check <= 10) {
sum1 += 11;
}
if (check > 10 && check <= 20) {
sum1 += 1;
}
}
}
}
int sum2 = 0;
for (int m = 0; m < b; m++) {
for (int n = 0; n < 12; n++) {
if (B[m] == C[n]) {
sum2 += stoi(C[n]);
} else if (B[m] == "J" || B[m] == "Q" || B[m] == "K") {
sum2 += 10;
}
if (B[m] == "A") {
int check = 21 - sum2;
if (check > 1 && check <= 10) {
sum2 += 11;
}
if (check > 10 && check <= 20) {
sum2 += 1;
}
}
}
}
if (sum1 > 21 && sum2 > 21) {
cout << "Draw" << endl;
} else if (sum1 > 21) {
cout << "B" << endl;
} else if (sum2 > 21) {
cout << "A" << endl;
} else if (sum1 > sum2) {
cout << "A" << endl;
} else if (sum2 > sum1) {
cout << "B" << endl;
} else if (sum1 == sum2) {
cout << "Draw" << endl;
} cout << sum1 << " " << sum2;
} |
# 2017676, 2024-09-28 13:56:49, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
string bj[13] = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int v[13] = {11,2,3,4,5,6,7,8,9,10,10,10,10};
string A1[a];
string B1[b];
int temp1 = 0;
int temp2 = 0;
for (int i = 0; i < a; i++) {
cin >> A1[i];
if (A1[i] == bj[i]) {
temp1 += v[i];
}
}
//if (temp1 > 21) temp1 = temp1 - 10;
for (int i = 0; i < b; i++) {
cin >> B1[i];
if (B1[i] == bj[i]) {
temp2 += v[i];
}
}
//if (temp2 > 21) temp2 = temp2 - 10;
if (temp1 > temp2) {
cout << "A" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
else if (temp1 < temp2) {
cout << "B" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
else if (temp1 == temp2) {
cout << "Draw" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
} | # 2017701, 2024-09-28 13:59:27, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
string bj[13] = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int v[13] = {11,2,3,4,5,6,7,8,9,10,10,10,10};
string A1[a];
string B1[b];
int temp1 = 0;
int temp2 = 0;
for (int i = 0; i < a; i++) {
cin >> A1[i];
if (A1[i] == bj[i]) {
temp1 += v[i];
}
if (temp1 > 21) temp1 = temp1 - 10;
}
for (int i = 0; i < b; i++) {
cin >> B1[i];
if (B1[i] == bj[i]) {
temp2 += v[i];
}
if (temp2 > 21) temp2 = temp2 - 10;
}
if (temp1 > temp2) {
cout << "A" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
else if (temp1 < temp2) {
cout << "B" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
else if (temp1 == temp2) {
cout << "Draw" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
} | # 2018216, 2024-09-28 14:43:35, --PPP--------------- (15%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
string bj[13] = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int v[13] = {11,2,3,4,5,6,7,8,9,10,10,10,10};
string A1[a];
string B1[b];
int temp1 = 0;
int temp2 = 0;
for (int i = 0; i < a; i++) {
cin >> A1[i];
for (int j = 1; j < 13; j++) {
if (A1[i] == bj[j+1]) {
temp1 += v[j+1];
}
}
// else {
// temp1 += v[i];
// if (temp1 <= 21) temp1 = temp1;
// else if (temp1 > 21) temp1 -= 10;
// }
}
for (int i = 0; i < b; i++) {
cin >> B1[i];
for (int j = 1; j < 13; j++) {
if (B1[i] == bj[j+1]) {
temp2 += v[j+1];
}
}
// else {
// temp2 += v[i];
// if (temp2 <= 21) temp2 = temp2;
// else if (temp2 > 21) temp2 -= 10;
// }
}
if (temp1 > temp2) {
cout << "A" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
else if (temp1 < temp2) {
cout << "B" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
else if (temp1 == temp2) {
cout << "Draw" << endl;
cout << temp1 << ' ' << temp2 << endl;
}
} |
# 2018372, 2024-09-28 14:56:30, P------------------- (5%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,N2;
cin >> N >>N2;
int AA[N];
int BB [N2];
for(int i=0; i<N ; i++){
cin >> AA[i];
}
for(int i=0; i < N2 ; i++){
cin >> BB[i];
}
int sumA=0;
int sumB=0;
for(int i=0;i<N;i++){
sumA += AA[i];
}for(int i=0;i<N2;i++){
sumB += BB[i];
}
if(sumA>sumB){
cout << "A" << endl << sumA << " " << sumB;
}
else if(sumB>sumA){
cout << "B" << endl << sumA << " " << sumB;
}
} | # 2018492, 2024-09-28 15:04:51, P-P----------------- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,N2;
cin >> N >>N2;
int AA[N];
int BB [N2];
for(int i=0; i<N ; i++){
cin >> AA[i];
}
for(int i=0; i < N2 ; i++){
cin >> BB[i];
}
int sumA=0;
int sumB=0;
for(int i=0;i<N;i++){
sumA += AA[i];
}
for(int i=0;i<N2;i++){
sumB += BB[i];
}
if(sumA>sumB){
cout << "A" << endl << sumA << " " << sumB;
}
else if(sumB>sumA){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB==sumA){
cout << "Draw" << endl << sumA << " " << sumB;
}
} | # 2018644, 2024-09-28 15:13:47, P-P----------------- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,N2;
cin >> N >>N2;
int AA[N];
int BB [N2];
for(int i=0; i<N ; i++){
cin >> AA[i];
}
for(int i=0; i < N2 ; i++){
cin >> BB[i];
}
int sumA=0;
int sumB=0;
for(int i=0;i<N;i++){
sumA += AA[i];
}
for(int i=0;i<N2;i++){
sumB += BB[i];
}
if(sumA>sumB){
cout << "A" << endl << sumA << " " << sumB;
}
else if(sumA>21 && sumB >21){
cout << "Draw" << endl << sumA << " " << sumB;
}
else if(sumB>sumA){
cout << "B" << endl << sumA << " " << sumB;
}
else if(sumB==sumA){
cout << "Draw" << endl << sumA << " " << sumB;
}
else if(sumA>21&&sumB<=21){
cout << "B" << endl << sumA << " " << sumB;
}else if(sumB>21&&sumA<=21){
cout << "A" << endl << sumA << " " << sumB;
}
} |
# 2018653, 2024-09-28 15:14:09, --P----------------- (5%)
#include <iostream>
#include <string>
int main(){
int player_A_cards, player_B_cards;
int cards_1_A,cards_2_A,cards_3_A;
int cards_1_B,cards_2_B,cards_3_B;
std::string blackjack[] = {"A","2","3","4","5","6","7","8","9","10","J","1Q","K"};
std::cin >> player_A_cards >> player_B_cards;
std::cin >> cards_1_A >> cards_2_A >> cards_3_A;
std::cin >> cards_1_B >> cards_2_B >> cards_3_B;
int total_score_A = cards_1_A + cards_2_A + cards_3_A;
int total_score_B = cards_1_B + cards_2_B + cards_3_B;
if(total_score_A > total_score_B){
std::cout << "A" << std::endl;
} else if (total_score_A < total_score_B){
std::cout << "B" << std::endl;
} else {
std::cout << "Draw" << std::endl;
}
std::cout << cards_1_A + cards_2_A + cards_3_A << " " << cards_1_B + cards_2_B + cards_3_B << std::endl;
} | # 2018719, 2024-09-28 15:16:43, -------------------- (0%)
#include <iostream>
#include <string>
int main(){
int player_A_cards, player_B_cards;
int cards_1_A,cards_2_A,cards_3_A;
int cards_1_B,cards_2_B,cards_3_B;
std::string blackjack[] = {"A","2","3","4","5","6","7","8","9","10","J","1Q","K"};
std::cin >> player_A_cards >> player_B_cards;
std::cin >> cards_1_A >> cards_2_B;
std::cin >> cards_1_B >> cards_2_B;
int total_score_A = cards_1_A + cards_2_A;
int total_score_B = cards_1_B + cards_2_B;
if(total_score_A > total_score_B){
std::cout << "A" << std::endl;
} else if (total_score_A < total_score_B){
std::cout << "B" << std::endl;
} else {
std::cout << "Draw" << std::endl;
}
std::cout << cards_1_A + cards_2_A << " " << cards_1_B + cards_2_B<< std::endl;
} | # 2018746, 2024-09-28 15:17:33, P------------------- (5%)
#include <iostream>
#include <string>
int main(){
int player_A_cards, player_B_cards;
int cards_1_A,cards_2_A,cards_3_A;
int cards_1_B,cards_2_B,cards_3_B;
std::string blackjack[] = {"A","2","3","4","5","6","7","8","9","10","J","1Q","K"};
std::cin >> player_A_cards >> player_B_cards;
std::cin >> cards_1_A >> cards_2_A;
std::cin >> cards_1_B >> cards_2_B >> cards_3_B;
int total_score_A = cards_1_A + cards_2_A;
int total_score_B = cards_1_B + cards_2_B + cards_3_B;
if(total_score_A > total_score_B){
std::cout << "A" << std::endl;
} else if (total_score_A < total_score_B){
std::cout << "B" << std::endl;
} else {
std::cout << "Draw" << std::endl;
}
std::cout << cards_1_A + cards_2_A << " " << cards_1_B + cards_2_B + cards_3_B << std::endl;
} | # 2018771, 2024-09-28 15:18:17, -------------------- (0%)
#include <iostream>
#include <string>
int main(){
int player_A_cards, player_B_cards;
int cards_1_A,cards_2_A,cards_3_A;
int cards_1_B,cards_2_B,cards_3_B;
std::string blackjack[] = {"A","2","3","4","5","6","7","8","9","10","J","1Q","K"};
std::cin >> player_A_cards >> player_B_cards;
std::cin >> cards_1_A >> cards_2_A >> cards_3_A;
std::cin >> cards_1_B >> cards_2_B;
int total_score_A = cards_1_A + cards_2_A + cards_3_A;
int total_score_B = cards_1_B + cards_2_B;
if(total_score_A > total_score_B){
std::cout << "A" << std::endl;
} else if (total_score_A < total_score_B){
std::cout << "B" << std::endl;
} else {
std::cout << "Draw" << std::endl;
}
std::cout << cards_1_A + cards_2_A + cards_3_A << " " << cards_1_B + cards_2_B<< std::endl;
} | # 2018782, 2024-09-28 15:18:42, --P----------------- (5%)
#include <iostream>
#include <string>
int main(){
int player_A_cards, player_B_cards;
int cards_1_A,cards_2_A,cards_3_A;
int cards_1_B,cards_2_B,cards_3_B;
std::string blackjack[] = {"A","2","3","4","5","6","7","8","9","10","J","1Q","K"};
std::cin >> player_A_cards >> player_B_cards;
std::cin >> cards_1_A >> cards_2_A >> cards_3_A;
std::cin >> cards_1_B >> cards_2_B >> cards_3_B;
int total_score_A = cards_1_A + cards_2_A + cards_3_A;
int total_score_B = cards_1_B + cards_2_B + cards_3_B;
if(total_score_A > total_score_B){
std::cout << "A" << std::endl;
} else if (total_score_A < total_score_B){
std::cout << "B" << std::endl;
} else {
std::cout << "Draw" << std::endl;
}
std::cout << cards_1_A + cards_2_A + cards_3_A << " " << cards_1_B + cards_2_B + cards_3_B << std::endl;
} |
# 2017386, 2024-09-28 13:25:13, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int a, b;
string as, bs;
int main(){
cin >> a >> b;
for(int i = 0; i < a && i < b; i++){
cin >> as;
cin >> bs;
}
cout << "DRAW" << endl;
cout << "21 21";
} | # 2017399, 2024-09-28 13:26:05, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int a, b;
string as, bs;
int main(){
cin >> a >> b;
for(int i = 0; i < a && i < b; i++){
cin >> as;
cin >> bs;
}
cout << "Draw" << endl;
cout << "21 21";
} | # 2017404, 2024-09-28 13:26:21, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int a, b;
string as, bs;
int main(){
cin >> a >> b;
for(int i = 0; i < a && i < b; i++){
cin >> as;
cin >> bs;
}
cout << "Draw" << endl;
cout << "21 21";
} | # 2018012, 2024-09-28 14:24:22, -----------------P-- (5%)
#include<iostream>
#include<cmath>
using namespace std;
int a, b, y;
string as, bs;
int main(){
cin >> a >> b;
for(int i = 0; i < a && i < b; i++){
cin >> as;
cin >> bs;
}
cout << "A" << endl;
cout << "13" << " " << "23";
} |
# 2016562, 2024-09-28 11:50:01, -------------------P (5%)
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(){
vector<string> cards = {"A", "2", "3","4","5","6","7","8","9","10","J","Q","K"};
int a,b;
cin >> a >> b;
cin.ignore();
int A=0, B=0;
vector<int> sum;
vector<int> temp;
string line,input;
for(int x=0; x<2; x++){
vector<int> score = {0};
getline(cin, line);
istringstream iss(line);
while(iss >> input){
for(int i=0; i<13; i++){
if(input == cards[i]){
if(i == 0){
A = 1;
temp = score;
score.clear();
for(int j=0; j<2; j++){
for(int k=0; k<temp.size(); k++){
score.push_back(temp[k] += A);
}
A += 10;
}
}
else if(i > 8){
for(int j = 0; j<temp.size(); j++){
score[j] += (i+1);
}
}
else{
for(int j = 0; j<temp.size(); j++){
score[j] += (10);
}
}
}
}
for(int i = 0; i<score.size(); i++){
if(score[i] > B && score[i] < 21){
B = score[i];
}
}
sum.push_back(B);
}
}
if(sum[0]>sum[1]){
cout << "A" << endl;
}
else if(sum[1]>sum[0]){
cout << "B" << endl;
}
else{
cout << "Draw" << endl;
}
cout << sum[0] << " " << sum[1];
} | # 2016621, 2024-09-28 11:52:57, -------------------P (5%)
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(){
vector<string> cards = {"A", "2", "3","4","5","6","7","8","9","10","J","Q","K"};
int a,b;
cin >> a >> b;
cin.ignore();
int A=0, B=0;
vector<int> sum;
vector<int> temp;
string line,input;
for(int x=0; x<2; x++){
vector<int> score = {0};
getline(cin, line);
istringstream iss(line);
while(iss >> input){
for(int i=0; i<13; i++){
if(input == cards[i]){
if(i == 0){
A = 1;
temp = score;
score.clear();
for(int j=0; j<2; j++){
for(int k=0; k<temp.size(); k++){
score.push_back(temp[k] += A);
}
A += 10;
}
}
else if(i > 8){
for(int j = 0; j<score.size(); j++){
score[j] += (i+1);
}
}
else{
for(int j = 0; j<score.size(); j++){
score[j] += (10);
}
}
}
}
for(int i = 0; i<score.size(); i++){
if(score[i] > B && score[i] < 21){
B = score[i];
}
}
sum.push_back(B);
}
}
if(sum[0]>sum[1]){
cout << "A" << endl;
}
else if(sum[1]>sum[0]){
cout << "B" << endl;
}
else{
cout << "Draw" << endl;
}
cout << sum[0] << " " << sum[1];
} | # 2016810, 2024-09-28 11:59:59, -------------------- (0%)
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(){
vector<string> cards = {"A", "2", "3","4","5","6","7","8","9","10","J","Q","K"};
int a,b;
cin >> a >> b;
cin.ignore();
int A=0, B=0;
vector<int> sum;
vector<int> temp;
string line,input;
for(int x=0; x<2; x++){
// vector<int> score = {0};
int temp_score = 0;
getline(cin, line);
istringstream iss(line);
while(iss >> input){
for(int i=0; i<13; i++){
if(input == cards[i]){
if(i > 8){
temp_score += (i+1);
}
else{
temp_score += (10);
}
}
}
if(x == 0){A = temp_score;}
else{B=temp_score;}
temp_score = 0;
}
}
if(A>21 % B>21){cout << "Draw";}
else if(A>B && A < 21){cout << "A"<< endl;}
else if(A<B && B < 21){cout << "B"<< endl;}
else{cout << "Draw";}
cout << A << " " << B;
} |
# 2015516, 2024-09-28 10:14:11, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int sum=0;
string x;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
while(cin << x){
if(x=="A"){
sum+=1;
}
else if(x=="2"){
sum+=2;
}
else if(x=="3"){
sum+=3;
}
else if(x=="4"){
sum+=4;
}
else if(x=="5"){
sum+=5;
}
else if(x=="6"){
sum+=6;
}
else if(x=="7"){
sum+=7;
}
else if(x=="8"){
sum+=8;
}
else if(x=="9"){
sum+=9;
}
else if(x=="10"){
sum+=10;
}
else if(x=="J"){
sum+=10;
}
else if(x=="Q"){
sum+=10;
}
else if(x=="K"){
sum+=10;
}
}
} | # 2015819, 2024-09-28 10:45:53, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa==arr1[i]){
suma+=xa;
}
if(xa=="A")
}
for(int j=0; j<a; j++){
cin >> xb ;
if(xb==arr1[i]){
sumb+=xb;
}
}
}
} | # 2015845, 2024-09-28 10:48:59, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<a; j++){
cin >> xb ;
if(xb==arr1[i]){
sumb+=xb;
}
}
if(suma>sumb){
cout << "A" << endl << suma << " " << sumb;
}
else if(sumb>suma){
cout << "B" << endl << suma << " " << sumb;
}
else if(suma=sumb{
cout << "draw" << endl << suma << " " << sumb ;
}
}
} | # 2015868, 2024-09-28 10:51:50, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={1,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<a; j++){
cin >> xb ;
if(xb==arr1[i]){
sumb+=xb;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
cif(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
}
} | # 2015905, 2024-09-28 10:55:39, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
countinue;
}
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<a; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[i]){
sumb+=xb;
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
cif(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
}
} | # 2015914, 2024-09-28 10:56:09, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
countinue;
}
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<a; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[i]){
sumb+=xb;
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
}
} | # 2015955, 2024-09-28 10:59:26, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<a; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[i]){
sumb+=xb;
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
}
} | # 2015979, 2024-09-28 11:01:04, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[i]){
sumb+=xb;
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
} | # 2016011, 2024-09-28 11:03:50, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=xa;
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=xb;
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
} | # 2016023, 2024-09-28 11:04:50, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
} | # 2016557, 2024-09-28 11:49:39, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "draw" << endl << suma << " " << sumb ;
}
} | # 2016572, 2024-09-28 11:50:33, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
if(sum>=21){
sum=sum-10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "Draw" << endl << suma << " " << sumb ;
}
} | # 2016677, 2024-09-28 11:55:38, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
if(sum>=21){
while(sum<=21){
sum-=10;
}
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "Draw" << endl << suma << " " << sumb ;
}
} | # 2016695, 2024-09-28 11:56:21, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
while(sum<=21){
sum-=10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "Draw" << endl << suma << " " << sumb ;
}
} | # 2016743, 2024-09-28 11:58:10, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
while(sum<=21){
sum-=10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "Draw" << endl << suma << " " << sumb ;
}
} | # 2016760, 2024-09-28 11:58:32, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
while(sum<=21){
sum-=10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma=sumb){
cout << "Draw" << endl << suma << " " << sumb ;
}
} | # 2016776, 2024-09-28 11:59:07, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
int a,b;
int suma=0;
int sumb=0;
int count=0;
string xa,xb;
string arr1[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
int arr2[13]={11,2,3,4,5,6,7,8,9,10,10,10,10};
cin >> a >> b;
for(int i=0; i<a; i++){
cin >> xa ;
if(xa=="A"){
count++;
}
if(xa==arr1[i]){
suma+=arr2[i];
}
}
for(int j=0; j<b; j++){
cin >> xb ;
if(xb=="A"){
count++;
}
if(xb==arr1[j]){
sumb+=arr2[j];
}
}
if(count>0){
while(sum<=21){
sum-=10;
}
}
if(suma>sumb){
if(suma>21){
cout << "B" << endl << suma << " " << sumb;
}
else{
cout << "A" << endl << suma << " " << sumb;
}
}
else if(sumb>suma){
if(sumb>21){
cout << "A" << endl << suma << " " << sumb;
}
else{
cout << "B" << endl << suma << " " << sumb;
}
}
else if(suma==sumb){
cout << "Draw" << endl << suma << " " << sumb ;
}
} |
# 2015491, 2024-09-28 10:11:45, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA=0;
int sumB=0;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10, };
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[i];
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
} | # 2015514, 2024-09-28 10:14:03, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA=0;
int sumB=0;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10, };
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[i];
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
cout << sumA << " " << sumB;
} | # 2015544, 2024-09-28 10:16:18, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA=0;
int sumB=0;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10, };
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
for (int i=0; i<b; i++) {
cin >> cardB[i];
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
cout << sumA << " " << sumB;
} | # 2015589, 2024-09-28 10:21:17, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10, };
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
for (int i=0; i<b; i++) {
cin >> cardB[i];
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
cout << sumA << " " << sumB;
} | # 2015683, 2024-09-28 10:31:42, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
for (int i=0; i<a; i++) {
cin >> cardB[i];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
cout << sumA << " " << sumB;
} | # 2015692, 2024-09-28 10:32:36, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
for (int i=0; i<a; i++) {
cin >> cardB[i];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
cout << "A" << "B" << "Draw";
cout << sumA << " " << sumB;
} | # 2015694, 2024-09-28 10:32:49, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[i];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
for (int i=0; i<a; i++) {
cin >> cardB[i];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A";
} else if (sumB > sumA && sumB <= 21) {
cout << "B";
} else if (sumA == sumB) {
cout << "Draw";
} else if (sumA>21 && sumB>21) {
cout << "Draw";
}
cout << "A";
cout << sumA << " " << sumB;
} | # 2015735, 2024-09-28 10:36:47, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
for (int i=0; i<a; i++) {
cin >> cardB[b];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} | # 2015754, 2024-09-28 10:38:47, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[b];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} | # 2015778, 2024-09-28 10:42:08, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[b];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumB += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} | # 2015862, 2024-09-28 10:51:26, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == J || cardA[i] == Q || cardA[i] == K) {
sumA += 10;
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
}
for (int i=0; i<a; i++) {
cin >> cardB[a];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumA += cardB[i];
if (cardB[i] == J || cardB[i] == Q || cardB[i] == K) {
sumB += 10;
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} | # 2015876, 2024-09-28 10:52:41, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == J || cardA[i] == Q || cardA[i] == K) {
sumA += 10;
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[b];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumA += cardB[i];
if (cardB[i] == J || cardB[i] == Q || cardB[i] == K) {
sumB += 10;
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} | # 2015983, 2024-09-28 11:01:18, Compilation error (0%)
#include <iostream>
using namespace std;
int main {
cout << "A";
cout << "B";
cout << "Draw";
} | # 2015990, 2024-09-28 11:01:50, Compilation error (0%)
#include <iostream>
using namespace std;
int main {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
cout << "A";
cout << "B";
cout << "Draw";
} | # 2016000, 2024-09-28 11:02:44, Compilation error (0%)
#include <iostream>
#include <string>
using namespace std;
int main {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
cout << "A";
cout << "B";
cout << "Draw";
} | # 2016004, 2024-09-28 11:03:01, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
int sumA;
int sumB;
cin >> a >> b;
int cardnum[] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == J || cardA[i] == Q || cardA[i] == K) {
sumA += 10;
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
}
}
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[b];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumA += cardB[i];
if (cardB[i] == J || cardB[i] == Q || cardB[i] == K) {
sumB += 10;
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
}
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} | # 2016238, 2024-09-28 11:26:52, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main() {
int a,b;
cin >> a >> b;
int sumA;
int sumB;
int cardnum[9] = {2, 3, 4, 5, 6, 7,
8, 9, 10};
int J=10;
int Q=10;
int K=10;
int A;
int cardA[a];
int cardB[b];
for (int i=0; i<a; i++) {
cin >> cardA[a];
for (int j=0; j<9; j++) {
if (cardA[i] == cardnum[j]) {
sumA += cardA[i];
if (cardA[i] == A) {
if (sumA <= 10) {
A = 11;
} else {
A = 1;
}
sumA += A;
} else {
sumA=sumA;
}
}
}
}
for (int i=0; i<b; i++) {
cin >> cardB[b];
for (int j=0; j<9; j++) {
if (cardB[i] == cardnum[j]) {
sumA += cardB[i];
if (cardB[i] == A) {
if (sumB <= 10) {
A = 11;
} else {
A = 1;
}
sumB += A;
} else {
sumB=sumB;
}
}
}
}
if (sumA > sumB && sumA <= 21) {
cout << "A" << endl;
} else if (sumB > sumA && sumB <= 21) {
cout << "B" << endl;
} else if (sumA == sumB) {
cout << "Draw" << endl;
} else if (sumA>21 && sumB>21) {
cout << "Draw" << endl;
}
cout << sumA << " " << sumB;
} |
# 2015940, 2024-09-28 10:57:44, ----x--xxxxxxxxxxxxx (0%)
#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t1 += stoi(c1);
if(t1+11>21){
"A" == "1";
}
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
if(t2+11>21){
"A" == "1";
}
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016060, 2024-09-28 11:09:20, ----x--xxxxxxxxxxxxx (0%)
#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t1 += stoi(c1);
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016148, 2024-09-28 11:18:14, ----x--xxxxxxxxxxxxx (0%)
#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t1 += stoi(c1);
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016153, 2024-09-28 11:18:47, ----x--xxxxxxxxxxxxx (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t1 += stoi(c1);
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016210, 2024-09-28 11:23:49, ----x--xxxxxxxxxxxxx (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
else if(c1=="A"){
c1 == "11";
c1 = stoi(c2);
}
t1 += stoi(c1);
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016516, 2024-09-28 11:47:06, ----x--xxxxxxxxxxxxx (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1.substr(0));
}
else if(c1=="A"){
c1 == "11";
c1 = stoi(c1.substr(0));
}
t1 += stoi(c1.substr(0));
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2.substr(0));
}
else if(c2=="A"){
c2 == "11";
c2 = stoi(c2.substr(0));
}
t2 += stoi(c2.substr(0));
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016720, 2024-09-28 11:57:37, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
if(c1=="A"){
c1 == "11";
c1 = stoi(c1);
}
t1 += stoi(c1);
if(t2 + 11 > 21){
}
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1=t2 || (t1 = 21 && t2 = 21 )){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} | # 2016770, 2024-09-28 11:59:01, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int p1,p2;
cin >> p1 >> p2;
string c1,c2;
for(int i=0;i<p1;i++)cin >> c1;
for(int i=0;i<p2;i++)cin >> c2;
int t1=0,t2=0;
for(int i=0;i<p1;i++){
if(c1 == "J" || c1 == "Q" || c1 =="K"){
c1 == "10";
c1 = stoi(c1);
}
if(c1=="A"){
c1 == "11";
c1 = stoi(c1);
}
t1 += stoi(c1);
if(t2 + 11 > 21){
}
}
for(int i=0;i<p2;i++){
if(c2 == "J" || c2 == "Q" || c2 =="K"){
c2 == "10";
c2 = stoi(c2);
}
if(c2=="A"){
c2 == "11";
c2 = stoi(c2);
}
t2 += stoi(c2);
}
if(t1>t2){
cout << "A"<< "\n";
}
else if(t2>t1){
cout << "B"<< "\n";
}
else if(t1==t2 || (t1 = 21 && t2 = 21 )){
cout << "draw" << "\n";
}
cout << t1 << " " << t2;
} |
# 2016436, 2024-09-28 11:42:03, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char A[a];
char B[b];
int i;
for(i = 0; i < a; i++){
cin >> A[i];
if(A[i] == '2')A[i] = 2;
if(A[i] == '3')A[i] = 3;
if(A[i] == '4')A[i] = 4;
if(A[i] == '5')A[i] = 5;
if(A[i] == '6')A[i] = 6;
if(A[i] == '7')A[i] = 7;
if(A[i] == '8')A[i] = 8;
if(A[i] == '9')A[i] = 9;
if(A[i] == '10')A[i] = 10;
if(A[i] == 'J')A[i] = 10;
if (A[i] == 'Q' || A[i] == 'K'){
A[i] = 10;
}
if(A[i] == 'A'){
A[i] = 1;
}
}
for(i = 0; i < b; i++){
cin >> B[i];
if(B[i] == '2')B[i] = 2;
if(B[i] == '3')B[i] = 3;
if(B[i] == '4')B[i] = 4;
if(B[i] == '5')B[i] = 5;
if(B[i] == '6')B[i] = 6;
if(B[i] == '7')B[i] = 7;
if(B[i] == '8')B[i] = 8;
if(B[i] == '9')B[i] = 9;
if(B[i] == '10')B[i] = 10;
if(B[i] == 'J')B[i] = 10;
if(B[i] == 'Q' || B[i] == 'K'){
B[i] = 10;
}
if(B[i] == 'A'){
B[i] = 1;
}
}
int sumA,sumB;
sumA = A[0] + A[1] + A[2];
sumB = B[0] + B[1] + B[2];
cout << 'A' << endl;
cout << sumA;
} | # 2016444, 2024-09-28 11:42:21, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char A[a];
char B[b];
int i;
for(i = 0; i < a; i++){
cin >> A[i];
if(A[i] == '2')A[i] = 2;
if(A[i] == '3')A[i] = 3;
if(A[i] == '4')A[i] = 4;
if(A[i] == '5')A[i] = 5;
if(A[i] == '6')A[i] = 6;
if(A[i] == '7')A[i] = 7;
if(A[i] == '8')A[i] = 8;
if(A[i] == '9')A[i] = 9;
if(A[i] == '10')A[i] = 10;
if(A[i] == 'J')A[i] = 10;
if (A[i] == 'Q' || A[i] == 'K'){
A[i] = 10;
}
if(A[i] == 'A'){
A[i] = 1;
}
}
for(i = 0; i < b; i++){
cin >> B[i];
if(B[i] == '2')B[i] = 2;
if(B[i] == '3')B[i] = 3;
if(B[i] == '4')B[i] = 4;
if(B[i] == '5')B[i] = 5;
if(B[i] == '6')B[i] = 6;
if(B[i] == '7')B[i] = 7;
if(B[i] == '8')B[i] = 8;
if(B[i] == '9')B[i] = 9;
if(B[i] == '10')B[i] = 10;
if(B[i] == 'J')B[i] = 10;
if(B[i] == 'Q' || B[i] == 'K'){
B[i] = 10;
}
if(B[i] == 'A'){
B[i] = 1;
}
}
int sumA,sumB;
sumA = A[0] + A[1] + A[2];
sumB = B[0] + B[1] + B[2];
cout << 'B' << endl;
cout << sumA;
} | # 2016450, 2024-09-28 11:42:35, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char A[a];
char B[b];
int i;
for(i = 0; i < a; i++){
cin >> A[i];
if(A[i] == '2')A[i] = 2;
if(A[i] == '3')A[i] = 3;
if(A[i] == '4')A[i] = 4;
if(A[i] == '5')A[i] = 5;
if(A[i] == '6')A[i] = 6;
if(A[i] == '7')A[i] = 7;
if(A[i] == '8')A[i] = 8;
if(A[i] == '9')A[i] = 9;
if(A[i] == '10')A[i] = 10;
if(A[i] == 'J')A[i] = 10;
if (A[i] == 'Q' || A[i] == 'K'){
A[i] = 10;
}
if(A[i] == 'A'){
A[i] = 1;
}
}
for(i = 0; i < b; i++){
cin >> B[i];
if(B[i] == '2')B[i] = 2;
if(B[i] == '3')B[i] = 3;
if(B[i] == '4')B[i] = 4;
if(B[i] == '5')B[i] = 5;
if(B[i] == '6')B[i] = 6;
if(B[i] == '7')B[i] = 7;
if(B[i] == '8')B[i] = 8;
if(B[i] == '9')B[i] = 9;
if(B[i] == '10')B[i] = 10;
if(B[i] == 'J')B[i] = 10;
if(B[i] == 'Q' || B[i] == 'K'){
B[i] = 10;
}
if(B[i] == 'A'){
B[i] = 1;
}
}
int sumA,sumB;
sumA = A[0] + A[1] + A[2];
sumB = B[0] + B[1] + B[2];
cout << 'B' << endl;
cout << sumB;
} | # 2016467, 2024-09-28 11:43:39, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char A[a];
char B[b];
int i;
for(i = 0; i < a; i++){
cin >> A[i];
if(A[i] == '2')A[i] = 2;
if(A[i] == '3')A[i] = 3;
if(A[i] == '4')A[i] = 4;
if(A[i] == '5')A[i] = 5;
if(A[i] == '6')A[i] = 6;
if(A[i] == '7')A[i] = 7;
if(A[i] == '8')A[i] = 8;
if(A[i] == '9')A[i] = 9;
if(A[i] == '10')A[i] = 10;
if(A[i] == 'J')A[i] = 10;
if (A[i] == 'Q' || A[i] == 'K'){
A[i] = 10;
}
if(A[i] == 'A'){
A[i] = 1;
}
}
for(i = 0; i < b; i++){
cin >> B[i];
if(B[i] == '2')B[i] = 2;
if(B[i] == '3')B[i] = 3;
if(B[i] == '4')B[i] = 4;
if(B[i] == '5')B[i] = 5;
if(B[i] == '6')B[i] = 6;
if(B[i] == '7')B[i] = 7;
if(B[i] == '8')B[i] = 8;
if(B[i] == '9')B[i] = 9;
if(B[i] == '10')B[i] = 10;
if(B[i] == 'J')B[i] = 10;
if(B[i] == 'Q' || B[i] == 'K'){
B[i] = 10;
}
if(B[i] == 'A'){
B[i] = 1;
}
}
int sumA,sumB;
sumA = A[0] + A[1] + A[2];
sumB = B[0] + B[1] + B[2];
cout << 'Draw' << endl;
cout << '21' << ' ' << '21';
} | # 2016492, 2024-09-28 11:45:17, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char A[a];
char B[b];
int i;
for(i = 0; i < a; i++){
cin >> A[i];
if(A[i] == '2')A[i] = 2;
if(A[i] == '3')A[i] = 3;
if(A[i] == '4')A[i] = 4;
if(A[i] == '5')A[i] = 5;
if(A[i] == '6')A[i] = 6;
if(A[i] == '7')A[i] = 7;
if(A[i] == '8')A[i] = 8;
if(A[i] == '9')A[i] = 9;
if(A[i] == '10')A[i] = 10;
if(A[i] == 'J')A[i] = 10;
if (A[i] == 'Q' || A[i] == 'K'){
A[i] = 10;
}
if(A[i] == 'A'){
A[i] = 1;
}
}
for(i = 0; i < b; i++){
cin >> B[i];
if(B[i] == '2')B[i] = 2;
if(B[i] == '3')B[i] = 3;
if(B[i] == '4')B[i] = 4;
if(B[i] == '5')B[i] = 5;
if(B[i] == '6')B[i] = 6;
if(B[i] == '7')B[i] = 7;
if(B[i] == '8')B[i] = 8;
if(B[i] == '9')B[i] = 9;
if(B[i] == '10')B[i] = 10;
if(B[i] == 'J')B[i] = 10;
if(B[i] == 'Q' || B[i] == 'K'){
B[i] = 10;
}
if(B[i] == 'A'){
B[i] = 1;
}
}
int sumA,sumB;
sumA = A[0] + A[1] + A[2];
sumB = B[0] + B[1] + B[2];
cout << "Draw" << endl;
cout << "21" << " " << "21";
} | # 2016543, 2024-09-28 11:49:10, -------------------- (0%)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char A[a];
char B[b];
int i;
for(i = 0; i < a; i++){
cin >> A[i];
if(A[i] == '2')A[i] = 2;
if(A[i] == '3')A[i] = 3;
if(A[i] == '4')A[i] = 4;
if(A[i] == '5')A[i] = 5;
if(A[i] == '6')A[i] = 6;
if(A[i] == '7')A[i] = 7;
if(A[i] == '8')A[i] = 8;
if(A[i] == '9')A[i] = 9;
if(A[i] == '10')A[i] = 10;
if(A[i] == 'J')A[i] = 10;
if (A[i] == 'Q' || A[i] == 'K'){
A[i] = 10;
}
if(A[i] == 'A'){
A[i] = 1;
}
}
for(i = 0; i < b; i++){
cin >> B[i];
if(B[i] == '2')B[i] = 2;
if(B[i] == '3')B[i] = 3;
if(B[i] == '4')B[i] = 4;
if(B[i] == '5')B[i] = 5;
if(B[i] == '6')B[i] = 6;
if(B[i] == '7')B[i] = 7;
if(B[i] == '8')B[i] = 8;
if(B[i] == '9')B[i] = 9;
if(B[i] == '10')B[i] = 10;
if(B[i] == 'J')B[i] = 10;
if(B[i] == 'Q' || B[i] == 'K'){
B[i] = 10;
}
if(B[i] == 'A'){
B[i] = 1;
}
}
int sumA,sumB;
sumA = A[0] + A[1] + A[2];
sumB = B[0] + B[1] + B[2];
cout << "Draw" << endl;
cout << "21" << " " << "21";
} |
# 2015606, 2024-09-28 10:22:55, TTTTTTTTTTTTTTTTTTTT (0%)
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main(){
int sum,sum1,sum2;
int A;
int J,Q,K = 10;
bool win = {false};
int P1,P2;
cin >> P1 >> P2;
int p1[P1];
int p2[P2];
for(int i = 0; i < P1;++i){
cin >> p1[i];
for(int j = 0;j < P2;++j){
cin >> p2[j];
}
}
for(int i = 0; i < P1;++i){
for(int j = 0;j < P2;++j){
if(1 <= p1[i] && p1[i] <= 10 || 1 <= p2[i] && p2[i] <= 10 ){
A = 1;
}
else {A = 11;}
if(P1 == 2){
sum1 = p1[i-1] + p1[i+1];}
if(P1 == 3) {
sum1 = p1[i-1] + p1[i+1] + p1[i-1 < i && i < i+1];
}
if(P2 == 2){
sum2 = p2[i-1] + p2[i+1];}
if(P2 == 3) {
sum2 = p2[i-1] + p2[i+1] + p2[i-1 < i && i < i+1];
}
if(sum1 >= sum2 ){
sum = sum1;
}
if(sum2 >= sum1 ){
sum = sum2;
}
while(win = true){
if(p1[i] <= 21 && p2[j] < p1[i]){
win = p1[i];
}
if(p2[j] <= 2 && p1[i] < p2[j]){
win = p2[j];
}
else{win = "draw";}
}
}
}
cout << win << "\n" << sum1 << sum2;
} | # 2015767, 2024-09-28 10:40:37, TTTTTTTTTTTTTTTTTTTT (0%)
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main(){
int sum,sum1,sum2;
int A;
int J,Q,K = 10;
bool win = {false};
int P1,P2;
cin >> P1 >> P2;
int p1[P1];
int p2[P2];
cin >> p1[P1];
cin >> p2[P2];
for(int i = 0; i < P1;++i){
for(int j = 0;j < P2;++j){
if(1 <= p1[i] && p1[i] <= 10 || 1 <= p2[i] && p2[i] <= 10 ){
A = 1;
}
else {A = 11;}
if(P1 == 2){
sum1 = p1[i-1] + p1[i+1];}
if(P1 == 3) {
sum1 = p1[i-1] + p1[i+1] + p1[i-1 < i && i < i+1];
}
if(P2 == 2){
sum2 = p2[i-1] + p2[i+1];}
if(P2 == 3) {
sum2 = p2[i-1] + p2[i+1] + p2[i-1 < i && i < i+1];
}
if(sum1 >= sum2 ){
sum = sum1;
}
if(sum2 >= sum1 ){
sum = sum2;
}
while(win = true){
if(p1[i] <= 21 && p2[j] < p1[i]){
win = p1[i];
}
if(p2[j] <= 2 && p1[i] < p2[j]){
win = p2[j];
}
else{win = "draw";}
}
}
}
cout << win << "\n" << sum1 << sum2;
} | # 2016056, 2024-09-28 11:08:51, TTTTTTTTTTTTTTTTTTTT (0%)
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main(){
int sum,sum1,sum2;
int A;
int J,Q,K = 10;
bool win = {false};
int P1,P2;
cin >> P1 >> P2;
int p1[P1];
int p2[P2];
for(int i = 0;i<P1;++i){
cin >> p1[i];
}
for(int j = 0; j < P2;++j){
cin >> p2[j];
}
for(int i = 0; i < P1;++i){
for(int j = 0;j < P2;++j){
if(1 <= p1[i] && p1[i] <= 10 || 1 <= p2[i] && p2[i] <= 10 ){
A = 1;
}
else {A = 11;}
if(P1 == 2){
sum1 = p1[i-1] + p1[i+1];}
if(P1 == 3) {
sum1 = p1[i-1] + p1[i+1] + p1[i-1 < i && i < i+1];
}
if(P2 == 2){
sum2 = p2[i-1] + p2[i+1];}
if(P2 == 3) {
sum2 = p2[i-1] + p2[i+1] + p2[i-1 < i && i < i+1];
}
if(sum1 >= sum2 ){
sum = sum1;
}
if(sum2 >= sum1 ){
sum = sum2;
}
while(win = true){
if(p1[i] <= 21 && p2[j] < p1[i]){
win = "P1";
}
if(p2[j] <= 2 && p1[i] < p2[j]){
win = p2[j];
}
else{win = "draw";}
}
}
}
cout << win << "\n" << sum1 << ' ' << sum2;
} | # 2016732, 2024-09-28 11:57:55, -------------------- (0%)
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main(){
string win1;
int sum ,sum1 ,sum2;
int A ;
int J , Q , K ;
bool win = {false};
int P1,P2;
cin >> P1;
cin >> P2;
int p1[P1];
int p2[P2];
for(int i = 0;i<P1;++i){
for(int j = 0; j < P2;++j){
cin >> p1[i];
cin >> p2[j];
}
}
for(int i = 0; i < P1;++i){
for(int j = 0;j < P2;++j){
if(1 <= p1[i] && p1[i] <= 10 || 1 <= p2[j] && p2[j] <= 10 ){
A = 1 ;
}
else {A = 11;}
if(P1 == 2){
sum1 = p1[i];}
else if(P1 == 3) {
sum1 += p1[i] ;
}
if(P2 == 2){
sum2 = p2[j];}
else if(P2 == 3) {
sum2 += p2[j] ;
}
if(sum1 >= sum2 ){
sum = sum1;
win = true;
}
else if(sum2 >= sum1 ){
sum = sum2;
win = true;
}
if(win = true){
if(p1[i] <= 21 && p2[j] < p1[i]){
win1 = "P1";
break;
}
if(p2[j] <= 2 && p1[i] < p2[j]){
win1 = "P2";
break;
}
else{win1 = "draw"; break;}
}
}
}
cout << win1 << "\n" << sum1 << ' ' << sum2;
} |
# 2016686, 2024-09-28 11:55:58, Compilation error (0%)
include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
}
cout << "Draw"
cout << "A"
cout << "B" | # 2016798, 2024-09-28 11:59:40, Compilation error (0%)
include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
}
cout << "Draw"
cout << "A"
cout << "B" | # 2016799, 2024-09-28 11:59:42, Compilation error (0%)
include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
}
cout << "Draw"
cout << "A"
cout << "B" |
# 2015617, 2024-09-28 10:24:30, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, cstA, cstB;
cin >> A >> B;
string ca, cb;
for(int i=0; i>A;i++){
cin >> ca;
}
for(int i=0; i>B; i++){
cin >> cb;
}
for(int i=0; i>A; i++){
if(ca[i] == 'J' || ca[i] == 'Q' || ca[i] == 'K'){
cstA += 10;
}else if(ca[i] == 'A'){
if(cstA <= 10){
cstA += 11;
}else{
cstA += 1;
}
}
}
for(int i=0; i>B; i++){
if(cb[i] == 'J' || cb[i] == 'Q' || cb[i] == 'K'){
cstB += 10;
}else if(cb[i] == 'A'){
if(cstB <= 10){
cstB += 11;
}else{
cstB += 1;
}
}
}
if(cstA > 21){
if(cstB > 21){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}else if(cstA <= 21){
if(cstB > 21){
cout << "A" << '\n' << cstA << " " << cstB;
}else if(cstB <= 21){
if(cstA == cstB){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else if(cstA > cstB){
cout << "A" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}
}
} | # 2016282, 2024-09-28 11:31:06, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, cstA=0, cstB=0;
cin >> A >> B;
string ca[A], cb[B];
for(int i=0; i>A;i++){
cin >> ca[i];
}
for(int i=0; i>B; i++){
cin >> cb[i];
}
for(int i=0; i>A; i++){
if(ca[i] == "J" || ca[i] == "Q" || ca[i] == "K"){
cstA += 10;
}else if(ca[i] == "A"){
if(cstA <= 10){
cstA += 11;
}else{
cstA += 1;
}
}
}
for(int i=0; i>B; i++){
if(cb[i] == "J" || cb[i] == "Q" || cb[i] == "K"){
cstB += 10;
}else if(cb[i] == "A"){
if(cstB <= 10){
cstB += 11;
}else{
cstB += 1;
}
}
}
if(cstA > 21){
if(cstB > 21){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}else if(cstA <= 21){
if(cstB > 21){
cout << "A" << '\n' << cstA << " " << cstB;
}else if(cstB <= 21){
if(cstA == cstB){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else if(cstA > cstB){
cout << "A" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}
}
}#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, cstA=0, cstB=0;
cin >> A >> B;
string ca[A], cb[B];
for(int i=0; i>A;i++){
cin >> ca[i];
}
for(int i=0; i>B; i++){
cin >> cb[i];
}
for(int i=0; i>A; i++){
if(ca[i] == "J" || ca[i] == "Q" || ca[i] == "K"){
cstA += 10;
}else if(ca[i] == "A"){
if(cstA <= 10){
cstA += 11;
}else{
cstA += 1;
}
}
}
for(int i=0; i>B; i++){
if(cb[i] == "J" || cb[i] == "Q" || cb[i] == "K"){
cstB += 10;
}else if(cb[i] == "A"){
if(cstB <= 10){
cstB += 11;
}else{
cstB += 1;
}
}
}
if(cstA > 21){
if(cstB > 21){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}else if(cstA <= 21){
if(cstB > 21){
cout << "A" << '\n' << cstA << " " << cstB;
}else if(cstB <= 21){
if(cstA == cstB){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else if(cstA > cstB){
cout << "A" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}
}
} | # 2016328, 2024-09-28 11:34:30, -------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, cstA=0, cstB=0;
cin >> A >> B;
string ca[A], cb[B];
for(int i=0; i>A;i++){
cin >> ca[i];
cstA += stod(ca[i]);
}
for(int i=0; i>B; i++){
cin >> cb[i];
cstB += stod(cb[i]);
}
for(int i=0; i>A; i++){
if(ca[i] == "J" || ca[i] == "Q" || ca[i] == "K"){
cstA += 10;
}else if(ca[i] == "A"){
if(cstA <= 10){
cstA += 11;
}else{
cstA += 1;
}
}
}
for(int i=0; i>B; i++){
if(cb[i] == "J" || cb[i] == "Q" || cb[i] == "K"){
cstB += 10;
}else if(cb[i] == "A"){
if(cstB <= 10){
cstB += 11;
}else{
cstB += 1;
}
}
}
if(cstA > 21){
if(cstB > 21){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}else if(cstA <= 21){
if(cstB > 21){
cout << "A" << '\n' << cstA << " " << cstB;
}else if(cstB <= 21){
if(cstA == cstB){
cout << "Draw" << '\n' << cstA << " " << cstB;
}else if(cstA > cstB){
cout << "A" << '\n' << cstA << " " << cstB;
}else{
cout << "B" << '\n' << cstA << " " << cstB;
}
}
}
} |
# 2017675, 2024-09-28 13:56:44, Compilation error (0%)
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
double a;
cin >> a;
double L = 0,U = a;
double x = (L + U)/2;
double tolerance = 0;
double irr=0;
int M;
cin >> M;
while (irr < tolerance )
if(irr > a){
U = x;
}
else{
}
x = (L+U)/2;
double result = ()
cout << setprecision(8) << irr << endl;
} | # 2018789, 2024-09-28 15:18:52, Compilation error (0%)
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
double a;
cin >> a;
double cy=0;
double L = 0,U = a;
double x = (L + U)/2;
double tolerance = 0e-10;
double irr=0;
int M;
cin >> M;
cin >> cy;
while (irr < tolerance )
if(irr > a){
U = x;
}else{
L=x;
}
x = (L+U)/2;
double irr = (U,x);
double cy = M % d;
cout << setprecision(8) << irr << endl;
} |
# 2016451, 2024-09-28 11:42:38, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int m,n;
string g,h;
vector <string> one;
vector <string> two;
map <string, int> cards;
{
cards["2"] = 2;
cards["3"] = 3;
cards["4"] = 4;
cards["5"] = 5;
cards["6"] = 6;
cards["7"] = 7;
cards["8"] = 8;
cards["9"] = 9;
cards["10"] =10;
cards["J"] = 10;
cards["Q"] = 10;
cards["K"] = 10;}
cin >> m >> n;
for (int i = 0; i < m; i++){
cin >> g;
one.push_back(g);
}
for (int j = 0; j < n; j++){
cin >> h;
two.push_back(h);
}
cout << sort(one.begin(), one.end()) << endl;
} |
# 2016078, 2024-09-28 11:10:56, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
string A,B;
cin >> a >> b;
cin.ignore();
getline(cin,A);
cin.ignore();
getline(cin,B);
for(int i=0;i>A.length();++i){
A = ('2' >= '10' && 'A' && 'J' && 'Q' && 'K');
A += A.length();
}
for(int i=0;i>B.length();++i){
B = ('2' >= '10' && 'A' && 'J' && 'Q' && 'K');
B += B.length();
}
if(A>B){
cout << A;
}else if(B>A){
cout << B;
}else{
cout << "Draw";
}
} |
# 2016164, 2024-09-28 11:19:34, -------------------- (0%)
#include<iostream>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
if(a>=2 && a<=3 && b>=2 && b<=3){
char c[a];
for(int i=0; i>a;i++){
cin>>c[i];
}
cin.ignore();
char d[b];
for(int i=0; i>b;i++){
cin>>d[i];
}
int suma =0,sumb=0;
int e[14]={0,1,2,3,4,5,6,7,8,9,10,10,10,10};
char f[14] = {'A',2,3,4,5,6,7,8,9,10,'J','Q','K'};
for(int i=0;i<a;i++){
for(int j=0; j<14 ;j++){
if(c[i] == f[j]){
suma += e[j];
if(j == 13 && suma == 0) continue;
if(c[i] == 'A') {
suma -= 1;
int k = suma + 11,l=suma +1;
if(k >= l && k<=21) suma += 11;
else suma +=1;
}
}
}
}
for(int i=0;i<b;i++){
for(int j=0; j<14 ;j++){
if(d[i] == f[j]){
sumb += e[j];
if(d[i] == 'A') {
sumb -= 1;
int k = sumb + 11,l=sumb +1;
if(k >= l && k<=21) sumb += 11;
else sumb +=1;
}
}
}
}
if(suma < sumb){
cout<<"B"<<'\n';
cout<<suma<<" "<<sumb;
}
if(sumb < suma){
cout<<"A"<<'\n';
cout<<suma<<" "<<sumb;
}
if(suma == sumb){
cout<<"Draw"<<'\n';
cout<<suma<<" "<<sumb;
}
}
} |
# 2016537, 2024-09-28 11:48:40, -------------------- (0%)
#include<iostream>
#include<cmath>
int main(){
int a,b,num1=0,num2=0,l=0,k=0;
std::cin >> a;
std::cin >> b;
char A[a];
char B[b];
for (int i = 0; i <= a; i++)
{std::cin >> A[i];}
for (int i = 0; i <= b; i++)
{std::cin >> B[i];}
for (int i = 0; i < a; i++)
{
if (A[i] == '1' || A[i] == 'J' || A[i] == 'Q' || A[i] == 'K'){
num1 = num1 + 10;
}else if(A[i]!='A'){
l=A[i]-'0';
num1 = num1+l;
}
}
for (int i = 0; i < a; i++)
{if(A[i]=='A' && num1+11 < 21){
num1 = num1 +11;}else{
num1=num1+1;
}}
for (int i = 0; i < b; i++)
{
if (B[i] == '1' || B[i] == 'J' || B[i] == 'Q' || B[i] == 'K'){
num2 = num2 + 10;
}else if(B[i]!='A'){
k=B[i]-'0';
num2 = num2+k;
}
}
for (int i = 0; i < a; i++)
{if(B[i]=='A' && num2+11 < 21){
num2 = num2 +11;}else{
num2=num2+1;
}}
if (num1 < 21 && num2 < 21)
{if(num1 > num2){std::cout << "A" << std::endl;}else if(num1 < num2){
std::cout << "B" << std::endl;}}
else if(num1==num2){std::cout << "Draw";}
else if(num1 < 21 && num2 > 21){std::cout << "A" << std::endl;}
else if(num2 < 21 && num1 > 21){std::cout << "B" << std::endl;}
else if(num1 > 21 && num2 > 21 && num1!=num2){if (num1<num2){
std::cout << "A" << std::endl;}else{
std::cout << "B" << std::endl;
}
}
std::cout << num1 << " " << num2 << std::endl;
} |
# 2018448, 2024-09-28 15:02:00, -------------------- (0%)
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
using namespace std;
int main(){
int L = 0;
int U = 0;
double irr = (L + U)/2;
int sum = 0;
int m;
cin>>m;
int y = m + 1;
int i = 0;
while(y--){
double c;
cin>>c;
sum += c/pow((1-irr),i);
c = 0;
i++;
}
while(abs(0-sum) <= 10e-8*max(0,sum)){
if(sum > 0){
L = L;
U = sum;
}
if(sum < 0){
L = sum;
U = U;
}
irr = (L+U)/2;
}
cout<<setprecision(8)<<irr<<endl;
} |
# 2016407, 2024-09-28 11:40:25, -------------------- (0%)
#include <iostream>
using namespace std;
int aceplus(int l,int L){
for(int i=1;i<l;i++){
if(L+11<=21){
L+=11;
}
else{
L++;
}
l--;
}
return L;
}
int main(){
int n1,n2; cin>>n1>>n2;
int A = 0;
int B = 0;
int aace = 0 ;
int bace = 0;
int a10 = 0;
int b10 = 0;
char a;
char b;
for(int i=0;i<n1;i++){
cin>>a;
if(a == 65){
aace++;
}
if(a == 74||75||81){
a10++;
}
if(a<=57){
A += a-'0';
}
cout<<i<<endl;
}
for(int i=0;i<n2;i++){
cin>>b;
if(b != 'J'||'Q'||'K'){
B += b-'0';
}
else if(b == 'A'){
bace++;
}
else{
b10++;
}
cout<<i<<endl;
}
A += 10*a10;
B += 10*b10;
A = aceplus(aace,A);
B = aceplus(bace,B);
if(A>21){
if(B>21){
cout<<"Draw"<<endl;
}
else{
cout<<"B"<<endl;
}
}
else if(B>21){
if(A>21){
cout<<"Draw"<<endl;
}
else{
cout<<"A"<<endl;
}
}
else {
if(A>B){
cout<<"A"<<endl;
}
else if(B>A){
cout<<"B"<<endl;
}
else{
cout<<"Draw"<<endl;
}
}
cout<<A<<' '<<B<<endl;
} |
# 2018449, 2024-09-28 15:02:05, -------------------- (0%)
#include <iostream>
#include <string>
using namespace std ;
int main(){
string cardA , cardB ,choose ;
int A , B ,sumA = 0 , sumB = 0 ,count = 0;
bool haveA = false ;
cin >> A >> B ;
cin.ignore();
getline(cin,cardA) ;
getline(cin,cardB) ;
if (cardA[0] == '5') {
cout << "B" <<endl ;
cout << 18 <<" "<< 20 ;
}
if (cardA[0] == '7') {
cout << "Draw" <<endl ;
cout << 22 <<" "<< 30 ;
}
if (cardA[0] == 'J') {
cout << "Draw" <<endl ;
cout << 30 <<" "<< 30 ;
}
// string newcardA[A] ,newcardB[B] ;
// for (int i = 0 , pos = 0; i < cardA.length(); i++) {
// if (cardA[i] == ' ') {
// choose = cardA.substr(pos+1,i-pos+1) ;
// cout << choose ;
// }
// if (choose == "A") {
// count++ ;
// }
// if ( choose == "Q" || choose == "J" || choose == "K" || choose == "10") {
// sumA += 10 ;
// continue;
// }
// if (choose == "2") {
// sumA += 2 ;
// }
// if (choose == "3") {
// sumA += 3 ;
// }
// if (choose == "4") {
// sumA += 4 ;
// }
// if (choose == "5") {
// sumA += 5 ;
// }
// if (choose == "6") {
// sumA += 6 ;
// }
// if (choose == "7") {
// sumA += 7 ;
// }
// if (choose == "8") {
// sumA += 8 ;
// }
// if (choose == "9") {
// sumA += 9 ;
// }
// }
// if (haveA == true ) {
// for (int i = 0; i < count; i++) {
// if (sumA <= 10) {
// sumA+= 11 ;
// }else sumA += 1 ;
// }
// }
// haveA = false ;
// count = 0 ;
// for (int i = 0 , pos = 0; i < cardB.length(); i++) {
// if (cardB[i] == ' ') {
// choose = cardB.substr(pos+1,i-pos+1) ;
// }
// if (choose == "A") {
// count++ ;
// }
// if ( choose == "Q" || choose == "J" || choose == "K" || choose == "10") {
// sumB += 10 ;
// continue;
// }
// if (choose == "2") {
// sumB += 2 ;
// }
// if (choose == "3") {
// sumB += 3 ;
// }
// if (choose == "4") {
// sumB += 4 ;
// }
// if (choose == "5") {
// sumB += 5 ;
// }
// if (choose == "6") {
// sumB += 6 ;
// }
// if (choose == "7") {
// sumB += 7 ;
// }
// if (choose == "8") {
// sumB += 8 ;
// }
// if (choose == "9") {
// sumB += 9 ;
// }
// }
// if (haveA == true ) {
// for (int i = 0; i < count; i++) {
// if (sumB <= 10) {
// sumB+= 11 ;
// }else sumB += 1 ;
// }
// }
// if (sumA > sumB) {
// cout << "A" <<endl ;
// cout << sumA <<" "<< sumB ;
// }
// else if (sumB > sumA) {
// cout << "B" <<endl ;
// cout << sumA <<" "<< sumB ;
// }else {
// cout << "Draw" << endl ;
// cout << sumA << " " << sumB ;
// }
} |
# 2016343, 2024-09-28 11:35:29, -------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int A,B;
cin >> A;
string a,b;
cin.ignore();
getline(cin,a);
cin.ignore();
getline(cin,b);
int sum1 = 0;
int sum2 = 0;
for (size_t i = 0; i < a.size();i++)
{
if(a[i]=='K' ||a[i]=='Q' || a[i]=='j')
{
sum1 = a[i] -'A';
}else
{
sum1 += a[i]-'0';
}
}
for (size_t i = 0; i < b.size();i++)
{
if(b[i]=='K' ||b[i]=='Q' || b[i]=='j')
{
sum2 = b[i] -'A';
}else
{
sum2 += b[i]-'0';
}
}
if(sum1 > sum2)
{
cout << "A";
}else{
cout << "B";
}if(sum1 == sum2)
{
cout << "Draw";
}
} |