ZJANS

a001. 哈囉

Beginner Last Update: 2025/05/16
基礎 IO

輸入一字串 s
輸出 “hello, ” + s


解法一、cin

✅ 完整代碼

評分結果(參考) : AC (2ms, 328KB)

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s;
    cin >> s;
    cout << "hello, " << s;

    return 0;
}

解法二、scanf

✅ 完整代碼

評分結果(參考) : AC (2ms, 328KB)

#include <bits/stdc++.h>
using namespace std;

int main(){
    char s[1000];
    scanf("%s", s);
    printf("hello, %s", s);

    return 0;
}