# UVa 488 ### 題目連結:[UVa488](http://domen111.github.io/UVa-Easy-Viewer/?488) ### 題述:輸入的第一列有一個整數n,代表有幾組測試資料。接下來每組測試資料有2列,各有1個正整數(A、F),A代表振幅(A<=9),F代表頻率。第一列以及各組測試資料間皆有一空白行。請參考sample input。 ### c++ code: ```cpp= #include <iostream> using namespace std ; int main() { int n ; cin >> n ; int a , b ; bool in=false; while(cin >> a >> b ) { if(!in) in=true; else cout<<"\n"; for(int i = 1 ; i <= b ; i++) { if (i!=1) { cout << endl ; } for ( int j = 1 ; j <= a ; j++) { for (int q = 1 ; q <= j ; q++) { cout << j ; } cout << "\n" ; } for ( int j = a-1 ; j >= 1 ; j--) { for (int q = j ; q >= 1 ; q--) { cout << j ; } cout << endl ; } } } } ``` :::success **``sample input``** 2 3 2 5 3 ::: :::success **``sample output``** 1 22 333 22 1 1 22 333 22 1 1 22 333 4444 55555 4444 333 22 1 1 22 333 4444 55555 4444 333 22 1 1 22 333 4444 55555 4444 333 22 1 ::: #### [返回首頁](https://hackmd.io/@fkleofk/APCS#488) ###### tags: `APCS選修` `C++` `UVa`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up