解法一、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;
}