#4592: VB


Roce59427 (Yuki)

學校 : 國立蘭陽女子高級中學
編號 : 8479
來源 : [61.56.172.245]
最後登入時間 :
2011-09-06 20:00:51
a001. 哈囉 -- Brian Kernighan | From: [61.56.177.12] | 發表日期 : 2010-11-24 20:58

 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪

 
#4593: Re:VB


YogiBear (test)

學校 : 國立臺中技術學院
編號 : 9150
來源 : [1.168.28.108]
最後登入時間 :
2023-08-20 22:48:07
a001. 哈囉 -- Brian Kernighan | From: [114.46.96.55] | 發表日期 : 2010-11-24 22:51

 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪



他本來建議的範例是這樣

Dim s As String

Open CONS For Input As #1
Input #1, s
Do Until EOF(1)
    Print "hello, "; s
    Input #1, s
Loop

現在新的範例是我建議的

我要建議之前測試也 AC 的

怎突然不行了

有點納悶。 
#4594: Re:VB


YogiBear (test)

學校 : 國立臺中技術學院
編號 : 9150
來源 : [1.168.28.108]
最後登入時間 :
2023-08-20 22:48:07
a001. 哈囉 -- Brian Kernighan | From: [114.46.96.55] | 發表日期 : 2010-11-24 22:55

 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪



他本來建議的範例是這樣

Dim s As String

Open CONS For Input As #1
Input #1, s
Do Until EOF(1)
    Print "hello, "; s
    Input #1, s
Loop

現在新的範例是我建議的

我要建議之前測試也 AC 的

怎突然不行了

有點納悶。



喔 改這樣好了

dim s as string
Open Cons for input as #1

do
    Line Input #1, s
       
    If trim(s) <> "" then
        print "hello, ";s
    end if
loop until eof(1)

測資裡面有空行,才會多輸出一行

加個判斷就不會了。

 

 
#4595: Re:VB


Roce59427 (Yuki)

學校 : 國立蘭陽女子高級中學
編號 : 8479
來源 : [61.56.172.245]
最後登入時間 :
2011-09-06 20:00:51
a001. 哈囉 -- Brian Kernighan | From: [61.56.177.12] | 發表日期 : 2010-11-24 23:31

 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪



他本來建議的範例是這樣

Dim s As String

Open CONS For Input As #1
Input #1, s
Do Until EOF(1)
    Print "hello, "; s
    Input #1, s
Loop

現在新的範例是我建議的

我要建議之前測試也 AC 的

怎突然不行了

有點納悶。



喔 改這樣好了

dim s as string
Open Cons for input as #1

do
    Line Input #1, s
       
    If trim(s) <> "" then
        print "hello, ";s
    end if
loop until eof(1)

測資裡面有空行,才會多輸出一行

加個判斷就不會了。

 

謝謝囉

我看了好久都看不出問題

 
ZeroJudge Forum