#16543: 請高手指教


hshua (hshua)

學校 : 新北市立林口高級中學
編號 : 52506
來源 : [125.228.147.181]
最後登入時間 :
2024-05-05 17:18:10
c784. PA. 木棍上的螞蟻 -- 2018高雄市高師大附中資訊學科能力 | From: [220.133.124.235] | 發表日期 : 2019-01-13 07:52

"螞蟻直接通過",想不出錯誤問題出在哪裡?

#include <iostream>
using namespace std;
int main(){
int u,L,N,T,x,cnt;
char d;
    ios::sync_with_stdio(false); cin.tie(NULL);
    while(cin>>u){
        while(u--){
            cin>>L>>N>>T;
            cnt=0;
            for(int i=0; i<N; i++){
                cin>>x>>d;
                if(d=='R' && (L-x)>=T) cnt++;
                else if(d=='L' && x>=T) cnt++;
            }
        }
        cout<<cnt<<endl;
    }
}

 

 
ZeroJudge Forum