Submission #60312185


Source Code Expand

Copy
#include <iostream>
using namespace std;
int main(void){
int n, d;
cin >> n >> d;
string s;
cin >> s;
int pos = 0;
while(d > 0){
if(s[s.length()-pos] == '@'){
s[s.length()-pos] = '.';
d--;
}
pos++;
}
for(int i=0; i<s.length(); i++){
if(i != s.length() - 1){
cout << s[i];
continue;
}
cout << s[i] << endl;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
using namespace std;
int main(void){
    int n, d;
    cin >> n >> d;
    string s;
    cin >> s;
    int pos = 0;
    while(d > 0){
        if(s[s.length()-pos] == '@'){
            s[s.length()-pos] = '.';
            d--;
        }
        pos++;
    }
    for(int i=0; i<s.length(); i++){
        if(i != s.length() - 1){
            cout << s[i];
            continue;
        }
        cout << s[i] << endl;
    }
    //cout << ans + d << endl;
    
}

Submission Info

Submission Time
Task B - Daily Cookie 2
User soraman
Language C++ 20 (gcc 12.2)
Score 200
Code Size 503 Byte
Status AC
Exec Time 1 ms
Memory 3560 KB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:16:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   16 |     for(int i=0; i<s.length(); i++){
      |                  ~^~~~~~~~~~~
Main.cpp:17:14: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   17 |         if(i != s.length() - 1){
      |            ~~^~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 18
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, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3496 KB
00_sample_01.txt AC 1 ms 3560 KB
00_sample_02.txt AC 1 ms 3360 KB
01_random_00.txt AC 1 ms 3420 KB
01_random_01.txt AC 1 ms 3496 KB
01_random_02.txt AC 1 ms 3520 KB
01_random_03.txt AC 1 ms 3520 KB
01_random_04.txt AC 1 ms 3488 KB
01_random_05.txt AC 1 ms 3424 KB
01_random_06.txt AC 1 ms 3452 KB
01_random_07.txt AC 1 ms 3484 KB
01_random_08.txt AC 1 ms 3524 KB
01_random_09.txt AC 1 ms 3364 KB
02_handmade_00.txt AC 1 ms 3432 KB
02_handmade_01.txt AC 1 ms 3520 KB
02_handmade_02.txt AC 1 ms 3516 KB
02_handmade_03.txt AC 1 ms 3556 KB
02_handmade_04.txt AC 1 ms 3560 KB


2025-03-28 (Fri)
16:16:50 +00:00