#53293: C++使用者請注意


ck1090932@gl.ck.tp.edu.tw (陳邦仁)

學校 : 臺北市立建國高級中學
編號 : 131859
來源 : [140.112.24.194]
最後登入時間 :
2025-10-07 15:41:17

以下三種寫法皆會 RE:

#include<iostream>
using namespace std;
int main(){
    int n,k;
    while (cin>>n>>k){
        if (n%k==0){cout<<"Ok!\n";}
        else{cout<<"Impossib1e!\n";}
    }
    return 0;
}
#include<iostream>
using namespace std;
int main(){
    int n,k;
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(0);
    while (cin>>n>>k){
        if (n%k==0&&k!=0){cout<<"Ok!\n";}
        else{cout<<"Impossib1e!\n";}
    }
    return 0;
}
#include<iostream>
using namespace std;
int main(){
    int n,k;
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(0);
    while (cin>>n>>k){
        if ((n%k==0&&k!=0)||n==0){cout<<"Ok!\n";}
        else{cout<<"Impossib1e!\n";}
    }
    return 0;
}