# GJ 輸入練習 ~~其實你們應該要會了才對~~ --- a036 一行版 http://tcgs.tc.edu.tw:1218/ShowProblem?problemid=a036 ---- ```cpp int a,b; cin >> a >> b; if(a>b){ cout << "A " << a-b; }else if(a<b){ cout << "B " << b-a; }else{ cout << 0; } ``` --- a037 N行版 http://tcgs.tc.edu.tw:1218/ShowProblem?problemid=a037 ---- ```cpp int n; cin >> n; for(int i = 0;i < n;i++){ int a,b; cin >> a >> b; if(a>b){ cout << "A " << a-b << "\n"; }else if(a<b){ cout << "B " << b-a << "\n"; }else{ cout << 0 << "\n"; } } ``` --- a038 0尾版 http://tcgs.tc.edu.tw:1218/ShowProblem?problemid=a038 ---- ```cpp while(true){ int a,b; cin >> a >> b; if(!a&&!b)break; if(a>b){ cout << "A " << a-b << "\n"; }else if(a<b){ cout << "B " << b-a << "\n"; }else{ cout << 0 << "\n"; } } ``` --- a039 EOF版 http://tcgs.tc.edu.tw:1218/ShowProblem?problemid=a039 ---- ```cpp int a,b; while(cin >> a >> b){ if(a>b){ cout << "A " << a-b << "\n"; }else if(a<b){ cout << "B " << b-a << "\n"; }else{ cout << 0 << "\n"; } } ``` --- a040 Case版 http://tcgs.tc.edu.tw:1218/ShowProblem?problemid=a040 ---- ```cpp int n; cin >> n; for(int i = 1;i <= n;i++){ int a,b; cin >> a >> b; cout << "Case " << i << ": "; if(a>b){ cout << "A " << a-b << "\n"; }else if(a<b){ cout << "B " << b-a << "\n"; }else{ cout << 0 << "\n"; } } ```
{"metaMigratedAt":"2023-06-15T02:27:26.538Z","metaMigratedFrom":"YAML","title":"GJ 輸入練習","breaks":true,"slideOptions":"{\"transition\":\"slide\"}","contributors":"[{\"id\":\"9f6a1b41-e592-4580-9e63-5613e2cac6cb\",\"add\":1531,\"del\":8}]"}
    177 views
   Owned this note