#30277: 第六行的WA究竟是怎麼回事?


chyang.be10@nycu.edu.tw (楊芊華)

學校 : 國立交通大學
編號 : 181512
來源 : [123.194.161.25]
最後登入時間 :
2024-01-30 04:42:21
c045. 00490 - Rotating Sentences -- UVa490 | From: [123.194.160.1] | 發表日期 : 2022-05-15 16:00

如題,至今不知為何WA

錯誤資訊如下

#0: 100% WA (line:6)

您的答案為: ergoe s leznogyei necoobn  iaxeqhss .chmt iaheans gs" e oirlnsotes luetrhn
正確答案為: ergoe s leznogyei necoobn  iaxeqhss .chmt iaheans gs" e oirlnsotes luetrhn


我有錯的CODE如下
#include<bits/stdc++.h>
using namespace std;
string s[105];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int row=0, col=0;
    while(getline(cin, s[col])){
        row=max(row , (int)s[col].size());
        col++;
    }
    for(int i=0; i<row; i++){
        for(int j=col-1; j>=0; j--){
            if(i>= s[j].size()) cout<<" ";
            cout<<s[j][i];
        }
        cout<<"\n";
    }
    return 0;
}
 
#30278: Re: 第六行的WA究竟是怎麼回事?


chyang.be10@nycu.edu.tw (楊芊華)

學校 : 國立交通大學
編號 : 181512
來源 : [123.194.161.25]
最後登入時間 :
2024-01-30 04:42:21
c045. 00490 - Rotating Sentences -- UVa490 | From: [123.194.160.1] | 發表日期 : 2022-05-15 16:01

如題,至今不知為何WA

錯誤資訊如下

#0: 100% WA (line:6)

您的答案為: ergoe s leznogyei necoobn  iaxeqhss .chmt iaheans gs" e oirlnsotes luetrhn
正確答案為: ergoe s leznogyei necoobn  iaxeqhss .chmt iaheans gs" e oirlnsotes luetrhn


我有錯的CODE如下
#include
using namespace std;
string s[105];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int row=0, col=0;
    while(getline(cin, s[col])){
        row=max(row , (int)s[col].size());
        col++;
    }
    for(int i=0; i=0; j--){
            if(i>= s[j].size()) cout<<" ";
            cout<

【題解】ZeroJudge c045: 00490 – Rotating Sentences – Yui Huang 演算法學習筆記

參考的AC CODE

 
#30279: Re: 第六行的WA究竟是怎麼回事?


chyang.be10@nycu.edu.tw (楊芊華)

學校 : 國立交通大學
編號 : 181512
來源 : [123.194.161.25]
最後登入時間 :
2024-01-30 04:42:21
c045. 00490 - Rotating Sentences -- UVa490 | From: [123.194.160.1] | 發表日期 : 2022-05-15 16:01

如題,至今不知為何WA

錯誤資訊如下

#0: 100% WA (line:6)

您的答案為: ergoe s leznogyei necoobn  iaxeqhss .chmt iaheans gs" e oirlnsotes luetrhn
正確答案為: ergoe s leznogyei necoobn  iaxeqhss .chmt iaheans gs" e oirlnsotes luetrhn


我有錯的CODE如下
#include
using namespace std;
string s[105];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int row=0, col=0;
    while(getline(cin, s[col])){
        row=max(row , (int)s[col].size());
        col++;
    }
    for(int i=0; i=0; j--){
            if(i>= s[j].size()) cout<<" ";
            cout<

【題解】ZeroJudge c045: 00490 – Rotating Sentences – Yui Huang 演算法學習筆記

參考的AC CODE

 
#30280: Re: 第六行的WA究竟是怎麼回事?


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [101.136.203.77]
最後登入時間 :
2024-04-07 15:34:14
c045. 00490 - Rotating Sentences -- UVa490 | From: [27.240.162.19] | 發表日期 : 2022-05-15 16:16

 
            if(i>= s[j].size()) cout<<" ";
            cout<<s[j][i];


少了一個else

 
ZeroJudge Forum