[ACM ] 488 WA
這題已經讓我吃了好幾個WA
題目 http://0rz.tw/ICjcV
程式碼彩色版 http://src.wtgstudio.com/?yr37TF
爬文發現大部分都錯在"最後輸出的波形結束不能空一行"
這點我有注意到
但還是發生WA
不過在"高中生程式解題系統" 竟然會通過XD
麻煩板友指點我一下
謝謝
============程式碼分隔線==================
#include <stdio.h>
#include <stdlib.h>
int main()
{
        int total;
        int amp, freq;
        int i, j, k, x;
        scanf ("%d", &total); /*scan total inputs*/
        for (i = 0; i < total; i++) {
                scanf ("%d %d", &, &freq); /*scan one input*/
                for (j = 0; j < freq; j++) {
                        /*1~amp*/
                        for (k = 1; k <= amp; k++) {
                                for (x = 0; x < k; x++)
                                        printf ("%d", k);
                                if(amp > 1)
                                        printf ("\n");
                        }
                        /*amp-1~1*/
                        for (k = amp - 1; k > 0; k--) {
                                for (x = k; x > 0; x--)
                                        printf ("%d", k);
                                if (k > 1) {
                                        printf("\n");
                                }
                        }
                        /*make a blank line*/
                        if (i < total - 1 || j < freq - 1 ) {
                                printf("\n\n");
                        }
                }
        }
    return 0;
}
============程式碼結束線==================
===input=====
2
3
2
2
2
===input end====
===output====
1
22
333
22
1
1
22
333
22
1
1
22
1
1
22
1
====output end===
--
※ 發信站: 批踢踢實業坊(ptt.cc) 
◆ From: 124.8.135.192
推
02/10 21:15, , 1F
02/10 21:15, 1F
→
02/10 21:48, , 2F
02/10 21:48, 2F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章