Please sign in first.
Submission #41344848
Source Code Expand
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;cin>>n;
string s;cin>>s;
int a=0,b=0;
for(int i=0;i<s.length();i++){
if(s[i]=='T') a++;
else b++;
}
if(a>b) cout<<'T'<<endl;
else if(a<b) cout<<'A'<<endl;
else if(s[n-1]=='T') cout<<'A'<<endl;
else cout<<'T'<<endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Overall Winner |
| User | gangbengr |
| Language | C++ (GCC 9.2.1) |
| Score | 100 |
| Code Size | 324 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 3560 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:15: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
9 | for(int i=0;i<s.length();i++){
| ~^~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 7 ms | 3496 KiB |
| 00_sample_01.txt | AC | 2 ms | 3444 KiB |
| 00_sample_02.txt | AC | 2 ms | 3412 KiB |
| 01_random_00.txt | AC | 2 ms | 3452 KiB |
| 01_random_01.txt | AC | 2 ms | 3452 KiB |
| 01_random_02.txt | AC | 3 ms | 3436 KiB |
| 01_random_03.txt | AC | 2 ms | 3476 KiB |
| 01_random_04.txt | AC | 2 ms | 3496 KiB |
| 01_random_05.txt | AC | 2 ms | 3480 KiB |
| 01_random_06.txt | AC | 2 ms | 3560 KiB |
| 01_random_07.txt | AC | 2 ms | 3448 KiB |
| 01_random_08.txt | AC | 2 ms | 3480 KiB |
| 01_random_09.txt | AC | 1 ms | 3392 KiB |
| 01_random_10.txt | AC | 2 ms | 3452 KiB |
| 01_random_11.txt | AC | 2 ms | 3552 KiB |