-- Problem - 1472B - Codeforces
solve (n:a:left) =
do
let one = (length . filter (==1) . map read . words) a
let two = (length . filter (==2) . map read . words) a
(if ((two `mod` 2) == 0 && (one `mod` 2) == 0)
then "YES"
else if ((one `mod` 2) == 0 && one > 0)
then "YES" else "NO"):solve(left)
solve _ = []
main = interact $ unlines . solve . tail . lines
这段代码为什么没有等全部输入完再输出
如果说是读取一行输出一行的话为什么有几行输入完后没有输出
如果最后一行改成了main = interact $ show . unlines . solve . tail . lines 它又会在输入完后输出
solve (n:a:left) =
do
let one = (length . filter (==1) . map read . words) a
let two = (length . filter (==2) . map read . words) a
(if ((two `mod` 2) == 0 && (one `mod` 2) == 0)
then "YES"
else if ((one `mod` 2) == 0 && one > 0)
then "YES" else "NO"):solve(left)
solve _ = []
main = interact $ unlines . solve . tail . lines
这段代码为什么没有等全部输入完再输出
如果说是读取一行输出一行的话为什么有几行输入完后没有输出
如果最后一行改成了main = interact $ show . unlines . solve . tail . lines 它又会在输入完后输出