Submission #19511831


Source Code Expand

Copy
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<stack>
#include<queue>
 
using namespace std;
 
int main()
{
    int K;
    string S;
    cin >> K >> S;

    if (S.length() <= K) {
        cout << S << endl;
    }
    else {
        for (int i = 0; i < K; i++) {
            cout << S[i];
        }
        cout << "..." << endl;
    }
}

Submission Info

Submission Time
Task B - ... (Triple Dots)
User honeylark
Language C++ (GCC 9.2.1)
Score 200
Code Size 430 Byte
Status AC
Exec Time 9 ms
Memory 3628 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:20: warning: comparison of integer expressions of different signedness: ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   18 |     if (S.length() <= K) {
      |         ~~~~~~~~~~~^~~~

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 15
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 sample_01.txt, sample_02.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt
Case Name Status Exec Time Memory
sample_01.txt AC 9 ms 3436 KB
sample_02.txt AC 3 ms 3604 KB
sub1_01.txt AC 2 ms 3624 KB
sub1_02.txt AC 2 ms 3488 KB
sub1_03.txt AC 2 ms 3488 KB
sub1_04.txt AC 2 ms 3544 KB
sub1_05.txt AC 2 ms 3484 KB
sub1_06.txt AC 2 ms 3580 KB
sub1_07.txt AC 3 ms 3568 KB
sub1_08.txt AC 2 ms 3484 KB
sub1_09.txt AC 3 ms 3624 KB
sub1_10.txt AC 3 ms 3628 KB
sub1_11.txt AC 2 ms 3620 KB
sub1_12.txt AC 2 ms 3560 KB
sub1_13.txt AC 4 ms 3420 KB