--- tags: 解題報告,zj --- # a001. 哈囉 題目連結: [Zerojudge](https://zerojudge.tw/ShowProblem?problemid=a001) ## 題目說明 接收輸入並依格式輸出 ## 想法 小心漏了空格 ## 參考答案 :::spoiler 點我展開 Runtime: 5ms Memory: 324KB 時間複雜度:O(1) 空間複雜度:O(1) ```cpp= #include<iostream> using namespace std; int main(){ string text; cin>>text; cout<<"hello, "<<text; return 0; } ``` [Github](https://github.com/henryleecode23/solve_record/tree/main/zerojudge/a001) ::: ## 解釋 ### 接收輸入 ```cpp=5 cin>>text; ``` ### 固定格式輸出 輸出格式為 `hello, {text}` $\qquad\quad \uparrow$ 注意這裡的空格 ```cpp=6 cout<<"hello, "<<text; ``` ## 其他語言解法 :::spoiler Python ```python= print("hello,", input()) ``` ::: --- {%hackmd @hlc23/dark-theme %}