THPTTD_102 - Thay chữ số

View as PDF

Submit solution

Points: 10.00 (partial)
Time limit: 1.0s
Memory limit: 256M
Input: replacedigit.inp
Output: replacedigit.out

Author:
Problem type
Allowed languages
C, C#, C++, Go, Java, JavaScript, Kotlin, Pascal, Perl, PHP, Python, Ruby, Rust, Scratch, Swift

In case the statement didn't load correctly, you can download the statement here: Statement


Comments

Please read the guidelines before commenting.



  • 3
    lephuochauhungvuong  commented on March 11, 2025, 7:44 a.m.
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    
    int main() {
        ifstream cin ("replacedigit.inp");
        ofstream cout("replacedigit.out");
        int T;
        cin >> T;
    
        while (T--) {
            long long n;
            cin >> n;
    
            string n_str = to_string(n);
            for (char &c : n_str) {
                if (c == '0') {
                    c = '5';
                }
            }
    
            cout << stoll(n_str) << endl;
        }
    
        return 0;
    }
    

  • -1
    leedat313  commented on July 31, 2024, 2:08 a.m. edited

    Lỗi "Unexpected EOF in the participant's output" nghĩa là sao vậy ạ? Em bị hoài mà không biết cách xử lí


    • -1
      ______  commented on Aug. 6, 2024, 1:41 a.m.

      https://luyencode.net/faq/ xem o day nhe


  • -1
    khanhdo29  commented on July 10, 2024, 2:22 p.m.

    test 9 là gì vậy ạ!