#21875: #0: 50% WA (line:5) 您的答案為: 1 2 6 1 0 0 1 1 1 0 正確答案為: 0 0 0 0 0 0 0 0 0 0 #1: 50% WA (line:5) 您的答案為: 1 1 1 0 0 0 0 0 0 0 正確答案為: 0 0 0 0 0 0 0 0 0 0


twm0970420996@gmail.com (小胖胖胖)

學校 : 不指定學校
編號 : 94884
來源 : [122.116.200.57]
最後登入時間 :
2020-07-13 23:16:38
e531. 10415 - Eb Alto Saxophone Player -- UVA | From: [122.116.200.57] | 發表日期 : 2020-07-28 22:55

#include <iostream>

 

using namespace std;

 

int cdefgab[8][10] ={

    0,1,1,0,0,0,0,0,0,0,

    0,1,0,0,0,0,0,0,0,0,

    0,1,1,1,0,0,1,1,1,1,

    0,1,1,1,0,0,1,1,1,0,

    0,1,1,1,0,0,1,1,0,0,

    0,1,1,1,0,0,1,0,0,0,

    0,1,1,1,0,0,0,0,0,0,

    0,0,0,0,0,0,0,0,0,0,

};

int CDEFGAB[7][10]={

    1,1,1,0,0,0,0,0,0,0,

    1,1,0,0,0,0,0,0,0,0,

    0,0,1,0,0,0,0,0,0,0,

    1,1,1,1,0,0,1,1,1,0,

    1,1,1,1,0,0,1,1,0,0,

    1,1,1,1,0,0,1,0,0,0,

    1,1,1,1,0,0,0,0,0,0,

};

int main(){

    int t = 0 ;

    int finger[10] = {0};

    int *p, *lastp = cdefgab[7];

    cin >> t;

    while(t--){

 

        for(int i = 0 ; i < 10 ;i++){

            finger[i] = 0;

        }

        string song = "";

        cin >> song ;

        for(int i = 0 ; i < song.length() ; i++){

            if(song[i] >= 'a' && song[i] <= 'g'){

                p = cdefgab[song[i] - 'a'];

            }

            else if(song[i] >= 'A' && song[i] <= 'G'){

                p = CDEFGAB[song[i] - 'A'];

            }

            for(int j = 0 ; j < 10 ; j++){

                if(p[j] == 1 && ( lastp[j] == 0 || i == 0 )){

                    finger[j]++;

                }

            }

            lastp = p;

        }

        for(int i = 0 ; i < 10 ; i++){

            cout << finger[i] << " ";

        }

        cout << endl;

    }

}

 

 
#21876: Re:#0: 50% WA (line:5) 您的答案為: 1 2 6 1 0 0 1 1 1 0 正確答案為: 0 0 0 0 0 0 0 0 0 0 #1: 50% WA (line:5) 您的答案為: 1 1 1 0 0 0 0 0 0 0 正確答案為: 0 0 0 0 0 0 0 0 0 0


twm0970420996@gmail.com (小胖胖胖)

學校 : 不指定學校
編號 : 94884
來源 : [122.116.200.57]
最後登入時間 :
2020-07-13 23:16:38
e531. 10415 - Eb Alto Saxophone Player -- UVA | From: [220.141.88.145] | 發表日期 : 2020-07-28 22:56

#include

 

using namespace std;

 

int cdefgab[8][10] ={

    0,1,1,0,0,0,0,0,0,0,

    0,1,0,0,0,0,0,0,0,0,

    0,1,1,1,0,0,1,1,1,1,

    0,1,1,1,0,0,1,1,1,0,

    0,1,1,1,0,0,1,1,0,0,

    0,1,1,1,0,0,1,0,0,0,

    0,1,1,1,0,0,0,0,0,0,

    0,0,0,0,0,0,0,0,0,0,

};

int CDEFGAB[7][10]={

    1,1,1,0,0,0,0,0,0,0,

    1,1,0,0,0,0,0,0,0,0,

    0,0,1,0,0,0,0,0,0,0,

    1,1,1,1,0,0,1,1,1,0,

    1,1,1,1,0,0,1,1,0,0,

    1,1,1,1,0,0,1,0,0,0,

    1,1,1,1,0,0,0,0,0,0,

};

int main(){

    int t = 0 ;

    int finger[10] = {0};

    int *p, *lastp = cdefgab[7];

    cin >> t;

    while(t--){

 

        for(int i = 0 ; i < 10 ;i++){

            finger[i] = 0;

        }

        string song = "";

        cin >> song ;

        for(int i = 0 ; i < song.length() ; i++){

            if(song[i] >= 'a' && song[i] <= 'g'){

                p = cdefgab[song[i] - 'a'];

            }

            else if(song[i] >= 'A' && song[i] <= 'G'){

                p = CDEFGAB[song[i] - 'A'];

            }

            for(int j = 0 ; j < 10 ; j++){

                if(p[j] == 1 && ( lastp[j] == 0 || i == 0 )){

                    finger[j]++;

                }

            }

            lastp = p;

        }

        for(int i = 0 ; i < 10 ; i++){

            cout << finger[i] << " ";

        }

        cout << endl;

    }

}

 

請問是不是有什麼小細節沒有考慮到~?

 
#21878: Re:#0: 50% WA (line:5) 您的答案為: 1 2 6 1 0 0 1 1 1 0 正確答案為: 0 0 0 0 0 0 0 0 0 0 #1: 50% WA (line:5) 您的答案為: 1 1 1 0 0 0 0 0 0 0 正確答案為: 0 0 0 0 0 0 0 0 0 0


IanWang20061204 (詭譎)

學校 : 臺北市立建國高級中學
編號 : 95399
來源 : [111.248.226.38]
最後登入時間 :
2024-11-10 00:36:50
e531. 10415 - Eb Alto Saxophone Player -- UVA | From: [61.228.177.215] | 發表日期 : 2020-07-29 10:08

#include

 

using namespace std;

 

int cdefgab[8][10] ={

    0,1,1,0,0,0,0,0,0,0,

    0,1,0,0,0,0,0,0,0,0,

    0,1,1,1,0,0,1,1,1,1,

    0,1,1,1,0,0,1,1,1,0,

    0,1,1,1,0,0,1,1,0,0,

    0,1,1,1,0,0,1,0,0,0,

    0,1,1,1,0,0,0,0,0,0,

    0,0,0,0,0,0,0,0,0,0,

};

int CDEFGAB[7][10]={

    1,1,1,0,0,0,0,0,0,0,

    1,1,0,0,0,0,0,0,0,0,

    0,0,1,0,0,0,0,0,0,0,

    1,1,1,1,0,0,1,1,1,0,

    1,1,1,1,0,0,1,1,0,0,

    1,1,1,1,0,0,1,0,0,0,

    1,1,1,1,0,0,0,0,0,0,

};

int main(){

    int t = 0 ;

    int finger[10] = {0};

    int *p, *lastp = cdefgab[7];

    cin >> t;

    while(t--){

 

        for(int i = 0 ; i < 10 ;i++){

            finger[i] = 0;

        }

        string song = "";

        cin >> song ;

        for(int i = 0 ; i < song.length() ; i++){

            if(song[i] >= 'a' && song[i] <= 'g'){

                p = cdefgab[song[i] - 'a'];

            }

            else if(song[i] >= 'A' && song[i] <= 'G'){

                p = CDEFGAB[song[i] - 'A'];

            }

            for(int j = 0 ; j < 10 ; j++){

                if(p[j] == 1 && ( lastp[j] == 0 || i == 0 )){

                    finger[j]++;

                }

            }

            lastp = p;

        }

        for(int i = 0 ; i < 10 ; i++){

            cout << finger[i] << " ";

        }

        cout << endl;

    }

}

 

請問是不是有什麼小細節沒有考慮到~?


有空白行

可以改成getline,或乾脆點string拿掉改成scanf也可以

 

 
#21887: Re:#0: 50% WA (line:5) 您的答案為: 1 2 6 1 0 0 1 1 1 0 正確答案為: 0 0 0 0 0 0 0 0 0 0 #1: 50% WA (line:5) 您的答案為: 1 1 1 0 0 0 0 0 0 0 正確答案為: 0 0 0 0 0 0 0 0 0 0


753951852456 (精神小伙不請自來)

學校 : 臺北市私立延平高級中學
編號 : 103367
來源 : [203.72.178.3]
最後登入時間 :
2022-04-13 12:40:32
e531. 10415 - Eb Alto Saxophone Player -- UVA | From: [203.72.178.1] | 發表日期 : 2020-07-29 13:13

#include

 

using namespace std;

 

int cdefgab[8][10] ={

    0,1,1,0,0,0,0,0,0,0,

    0,1,0,0,0,0,0,0,0,0,

    0,1,1,1,0,0,1,1,1,1,

    0,1,1,1,0,0,1,1,1,0,

    0,1,1,1,0,0,1,1,0,0,

    0,1,1,1,0,0,1,0,0,0,

    0,1,1,1,0,0,0,0,0,0,

    0,0,0,0,0,0,0,0,0,0,

};

int CDEFGAB[7][10]={

    1,1,1,0,0,0,0,0,0,0,

    1,1,0,0,0,0,0,0,0,0,

    0,0,1,0,0,0,0,0,0,0,

    1,1,1,1,0,0,1,1,1,0,

    1,1,1,1,0,0,1,1,0,0,

    1,1,1,1,0,0,1,0,0,0,

    1,1,1,1,0,0,0,0,0,0,

};

int main(){

    int t = 0 ;

    int finger[10] = {0};

    int *p, *lastp = cdefgab[7];

    cin >> t;

    while(t--){

 

        for(int i = 0 ; i < 10 ;i++){

            finger[i] = 0;

        }

        string song = "";

        cin >> song ;

        for(int i = 0 ; i < song.length() ; i++){

            if(song[i] >= 'a' && song[i] <= 'g'){

                p = cdefgab[song[i] - 'a'];

            }

            else if(song[i] >= 'A' && song[i] <= 'G'){

                p = CDEFGAB[song[i] - 'A'];

            }

            for(int j = 0 ; j < 10 ; j++){

                if(p[j] == 1 && ( lastp[j] == 0 || i == 0 )){

                    finger[j]++;

                }

            }

            lastp = p;

        }

        for(int i = 0 ; i < 10 ; i++){

            cout << finger[i] << " ";

        }

        cout << endl;

    }

}

 

請問是不是有什麼小細節沒有考慮到~?


有空白行

可以改成getline,或乾脆點string拿掉改成scanf也可以

 

簡單

 
#21921: Re:#0: 50% WA (line:5) 您的答案為: 1 2 6 1 0 0 1 1 1 0 正確答案為: 0 0 0 0 0 0 0 0 0 0 #1: 50% WA (line:5) 您的答案為: 1 1 1 0 0 0 0 0 0 0 正確答案為: 0 0 0 0 0 0 0 0 0 0


twm0970420996@gmail.com (小胖胖胖)

學校 : 不指定學校
編號 : 94884
來源 : [122.116.200.57]
最後登入時間 :
2020-07-13 23:16:38
e531. 10415 - Eb Alto Saxophone Player -- UVA | From: [111.252.137.48] | 發表日期 : 2020-07-30 22:30

#include

 

using namespace std;

 

int cdefgab[8][10] ={

    0,1,1,0,0,0,0,0,0,0,

    0,1,0,0,0,0,0,0,0,0,

    0,1,1,1,0,0,1,1,1,1,

    0,1,1,1,0,0,1,1,1,0,

    0,1,1,1,0,0,1,1,0,0,

    0,1,1,1,0,0,1,0,0,0,

    0,1,1,1,0,0,0,0,0,0,

    0,0,0,0,0,0,0,0,0,0,

};

int CDEFGAB[7][10]={

    1,1,1,0,0,0,0,0,0,0,

    1,1,0,0,0,0,0,0,0,0,

    0,0,1,0,0,0,0,0,0,0,

    1,1,1,1,0,0,1,1,1,0,

    1,1,1,1,0,0,1,1,0,0,

    1,1,1,1,0,0,1,0,0,0,

    1,1,1,1,0,0,0,0,0,0,

};

int main(){

    int t = 0 ;

    int finger[10] = {0};

    int *p, *lastp = cdefgab[7];

    cin >> t;

    while(t--){

 

        for(int i = 0 ; i < 10 ;i++){

            finger[i] = 0;

        }

        string song = "";

        cin >> song ;

        for(int i = 0 ; i < song.length() ; i++){

            if(song[i] >= 'a' && song[i] <= 'g'){

                p = cdefgab[song[i] - 'a'];

            }

            else if(song[i] >= 'A' && song[i] <= 'G'){

                p = CDEFGAB[song[i] - 'A'];

            }

            for(int j = 0 ; j < 10 ; j++){

                if(p[j] == 1 && ( lastp[j] == 0 || i == 0 )){

                    finger[j]++;

                }

            }

            lastp = p;

        }

        for(int i = 0 ; i < 10 ; i++){

            cout << finger[i] << " ";

        }

        cout << endl;

    }

}

 

請問是不是有什麼小細節沒有考慮到~?


有空白行

可以改成getline,或乾脆點string拿掉改成scanf也可以

 

簡單

請問這跟空白行有什麼關西@@

我用uva原文測資是對的

 
ZeroJudge Forum