#35296: c++殘風解


eddiehu (Eddiehu)

學校 : 不指定學校
編號 : 221727
來源 : [114.27.42.119]
最後登入時間 :
2024-02-09 23:40:06
j606. 2. 造字程式 -- 2023年1月APCS | From: [114.27.25.198] | 發表日期 : 2023-05-23 01:43

我覺得下面兩個連結的講解都不錯
 
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
int k,q,r,x;
string s[25];
cin>>k>>q>>r;
cin>>s[0];
for(int i=1;i<=q;i++){
s[i]=s[0];
for(int j=0;j<k;j++){
cin>>x;
s[i][x-1]=s[i-1][j];
}
}
for(int j=0;j<r;j++){
for(int i=1;i<=q;i++){
cout<<s[i][j];
}
cout<<endl;
}
 return 0;
}
 
 
 
/*https://www.youtube.com/watch?v=sgFaT7tsAtU
https://www.youtube.com/watch?v=D4-0Pu1m1CI
*/
    
 
#35982: Re: c++殘風解


goodlogic (GoodLogic)

學校 : 中原大學
編號 : 236459
來源 : [223.141.195.113]
最後登入時間 :
2024-04-22 12:53:24
j606. 2. 造字程式 -- 2023年1月APCS | From: [223.138.138.17] | 發表日期 : 2023-06-28 12:20

我覺得下面兩個連結的講解都不錯
 
#include
 
using namespace std;
 
int main(){
int k,q,r,x;
string s[25];
cin>>k>>q>>r;
cin>>s[0];
for(int i=1;i<=q;i++){
s[i]=s[0];
for(int j=0;j
cin>>x;
s[i][x-1]=s[i-1][j];
}
}
for(int j=0;j
for(int i=1;i<=q;i++){
cout<
}
cout<
}
 return 0;
}
 
 
 
/*https://www.youtube.com/watch?v=sgFaT7tsAtU
https://www.youtube.com/watch?v=D4-0Pu1m1CI
*/
    
 
請問為什麼s陣列長度使用r的話會出錯,我已經有先輸入r了,我看影片中是使用r+1



 
#35983: Re: c++殘風解


goodlogic (GoodLogic)

學校 : 中原大學
編號 : 236459
來源 : [223.141.195.113]
最後登入時間 :
2024-04-22 12:53:24
j606. 2. 造字程式 -- 2023年1月APCS | From: [223.138.138.17] | 發表日期 : 2023-06-28 12:21

我覺得下面兩個連結的講解都不錯
 
#include
 
using namespace std;
 
int main(){
int k,q,r,x;
string s[25];
cin>>k>>q>>r;
cin>>s[0];
for(int i=1;i<=q;i++){
s[i]=s[0];
for(int j=0;j
cin>>x;
s[i][x-1]=s[i-1][j];
}
}
for(int j=0;j
for(int i=1;i<=q;i++){
cout<
}
cout<
}
 return 0;
}
 
 
 
/*https://www.youtube.com/watch?v=sgFaT7tsAtU
https://www.youtube.com/watch?v=D4-0Pu1m1CI
*/
    
 
請問為什麼s陣列長度使用q的話會出錯,我已經有先輸入q了,我看影片中是使用q+1





 
ZeroJudge Forum