#8845: 為什麼一直TLE?


frank73255 (ya~~)

學校 : 臺北市立成功高級中學
編號 : 41002
來源 : [36.229.140.230]
最後登入時間 :
2018-01-30 23:59:44

#include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
int main()
{
int  h, w;
while(1){

scanf("%d %d", &h, &w);
printf("%d\n", 2*h+2*w);



}
return 0;
}
 
 為什麼一直TLE???請各位大大幫幫忙><!!
#8860: Re:為什麼一直TLE?


b821213 (後繼無人)

學校 : 臺南市私立興國高級中學
編號 : 9916
來源 : [122.116.210.216]
最後登入時間 :
2025-10-05 13:08:24


while(1){

 
因為你這句,他會永遠讀個沒停。我想你需要的也許是判斷 EOF 而不是無限地讀取?