关于freopen输入
  • 板块学术版
  • 楼主大眼仔Happy
  • 当前回复12
  • 已保存回复13
  • 发布时间2023/10/27 20:12
  • 上次更新2023/10/27 20:45:19
查看原帖
关于freopen输入
537046
大眼仔Happy楼主2023/10/27 20:12

rt.

test.in:
5
1 2 3 4
freopen("test.in","r",stdin);
freopen("test.out","w",stdout);
n=read();for(int i=1;i<=n;i++)a=read();

这样写会使得没有读入完而无法输出。

freopen("test.in","r",stdin);
freopen("test.out","w",stdout);
n=read();for(int i=1;i<=n;i++)a[i]=read();

而这样写却可以读入完,当然 an=0a_n=0。

为什么???

2023/10/27 20:12
加载中...