CONTEST ID : 1128 - 2023春-计导课设-9-12班-文件练习

文件操作练习。注意B题的读取不能用struct。
D和谐词汇的题,输入是若干字符串,不以空行结束. 所以 gets(line);    while (line[0]){... gets(line);}就会导致时间超限,代码在等空行,但in数据没有。应改为while(gets(line))。
/*文件练习B题. 读取一个包含7类数据的二进制文件,找到指定部分内容,并正确解释输出。
思路分析:主体框架是读取二进制文件,   while (fread(buffer, buffLen, 1, infile) > 0){...}
    因为二进制文件的记录长度是固定的,所以可以计算每条记录的长度,使用fseek直接定位到指定段;
    所以用fseek的话,实际只需要读一次就可以。
但是这道题的特殊之处在于,一条记录内是顺序包含7种类型数据,是分多次写入,因此带来的麻烦是
虽然每段内容结构相同,但不能用struct进行整块读取。
因为struct的成员之间有内存空隙;除非源文件本身是用struct格式写入才行。
    因此,可以直接定位,但必须分别读取,写出的代码冗长,且容易在变量名和输出格式上出错。
经测试,struct {含7种变量和数组}的长度为200, 但实际7种变量和数组的总长要小一些.
因此,可以直接定位,但必须分别读取,写出的代码冗长,且容易在变量名和输出格式上出错。
一种办法是:按总长度整块读取到字节数组中,然后再逐个定义对应类型的指针,按间接访问就可格式化解释输出。
例: char buffer[LEN];
int i=0; printf("%c\n", buffer[i]); i++;
short * hdPtr=&buffer[i];  printf("%hd\n", *hdPtr); i+=sizeof(short);
*/


SERVER TIME : 2025-09-20 00:54:03
Finished

STATUS : End    OPEN : Private
Start Time : 2023-03-20 20:00:00
End Time : 2023-05-04 23:59:00


Problem ID    User    Language    Result   

RunID User Nick Name Problem ID Result Memory Time Language Code Length Submit Time
1022842022211352Holour*Accepted65033
1072KB
13ms
C1987 bytes2023-05-04 22:28:42
1022832022211332渋谷最強伝說と下海のJK!女同唐可可です*Accepted69985
1192KB
10ms
C1431 bytes2023-05-04 22:28:39
1022822022211352Holour*Accepted101846
1192KB
12ms
C2082 bytes2023-05-04 22:26:53
1022812022211321路人明ingWrong Answer
1196KB
14ms
C1491 bytes2023-05-04 22:26:07
1022802022211352HolourTime Limit Exceed
1068KB
8804ms
C2139 bytes2023-05-04 22:26:03
1022792021211266守旧派--中华王源Accepted
1196KB
13ms
C1640 bytes2023-05-04 22:25:42
1022782022211352HolourTime Limit Exceed
1068KB
8811ms
C2136 bytes2023-05-04 22:24:14
1022752022211319武16大大Accepted
1068KB
11ms
C1910 bytes2023-05-04 22:21:12
1022742022211274一壹一Accepted
1196KB
65ms
C1963 bytes2023-05-04 22:19:53
1022702022211321路人明ingWrong Answer
1192KB
11ms
C1507 bytes2023-05-04 22:17:20
1022682022211319武16大大Compile Error
0KB
0ms
C1975 bytes2023-05-04 22:16:37
1022672022211274一壹一Wrong Answer
1196KB
62ms
C1936 bytes2023-05-04 22:15:52
1022652022211349泰拉瑞亚糕手Runtime Error
1204KB
9ms
C959 bytes2023-05-04 22:15:45
1022642022211274一壹一Wrong Answer
1196KB
60ms
C1942 bytes2023-05-04 22:14:39
1022622022211274一壹一Wrong Answer
1196KB
60ms
C1945 bytes2023-05-04 22:13:45
1022602022211274一壹一Wrong Answer
1196KB
56ms
C1956 bytes2023-05-04 22:11:54
1022592022211349泰拉瑞亚糕手Compile Error
0KB
0ms
C962 bytes2023-05-04 22:11:54
1022562022211352Holour*Accepted64826
1192KB
12ms
C1735 bytes2023-05-04 22:09:35
1022492022211321路人明ingWrong Answer
1192KB
10ms
C1485 bytes2023-05-04 22:06:41
1022422022211296velpro*Accepted65101
1068KB
9ms
C1931 bytes2023-05-04 22:01:20
1022412022211351我不会写java*Accepted65101
1068KB
10ms
C1931 bytes2023-05-04 22:01:13
1022402022211329别挡我的路*Accepted74037
1068KB
10ms
C929 bytes2023-05-04 22:00:31
1022372022211351我不会写java*Accepted101846
1192KB
13ms
C2023 bytes2023-05-04 21:59:52
1022362022211351我不会写javaCompile Error
0KB
0ms
C2327 bytes2023-05-04 21:58:42
1022342022211355Compile Error
0KB
0ms
C1532 bytes2023-05-04 21:58:11
1022322022211329别挡我的路Compile Error
0KB
0ms
C939 bytes2023-05-04 21:57:14
1022302022211321路人明ingWrong Answer
1192KB
12ms
C1449 bytes2023-05-04 21:56:35
1022292022211351我不会写java*Accepted64826
1192KB
12ms
C2726 bytes2023-05-04 21:56:27
1022252022211351我不会写java*Accepted65116
1192KB
12ms
C3138 bytes2023-05-04 21:53:41
1022232022211274一壹一Compile Error
0KB
0ms
C2463 bytes2023-05-04 21:52:52
1022212022211274一壹一Wrong Answer
1196KB
60ms
C1934 bytes2023-05-04 21:51:47
1022182022211333瑟瑟发抖吧Accepted
1240KB
10ms
C2376 bytes2023-05-04 21:51:18
1022152022211274一壹一Compile Error
0KB
0ms
C2469 bytes2023-05-04 21:49:29
1022142022211341biomooRuntime Error
1068KB
11ms
C1961 bytes2023-05-04 21:48:54
1022132022211333瑟瑟发抖吧Accepted
1240KB
12ms
C2376 bytes2023-05-04 21:48:21
1022122022211321路人明ingTime Limit Exceed
1192KB
3529ms
C1441 bytes2023-05-04 21:48:02
1022102022211341biomooRuntime Error
1068KB
12ms
C1957 bytes2023-05-04 21:46:27
1022082022211355Compile Error
0KB
0ms
C2177 bytes2023-05-04 21:46:09
1022072022211274一壹一Time Limit Exceed
1200KB
9ms
C1882 bytes2023-05-04 21:45:28
1022052022211274一壹一Time Limit Exceed
1200KB
9ms
C1885 bytes2023-05-04 21:44:52
1022032022211274一壹一Compile Error
0KB
0ms
C2469 bytes2023-05-04 21:44:19
1022012022211355Accepted
1192KB
12ms
C2326 bytes2023-05-04 21:43:51
1022002022211274一壹一Time Limit Exceed
1200KB
10ms
C1891 bytes2023-05-04 21:43:22
1021992022211321路人明ingOutput Limit Exceed
1192KB
3533ms
C1420 bytes2023-05-04 21:41:58
1021962022211287linWrong Answer
1192KB
11ms
C2280 bytes2023-05-04 21:39:07
1021932022211265库丽米拉·叶尔兰*Accepted65101
1068KB
12ms
C1931 bytes2023-05-04 21:31:07
1021922022211333瑟瑟发抖吧Wrong Answer
1240KB
12ms
C2171 bytes2023-05-04 21:29:56
1021912022211265库丽米拉·叶尔兰*Accepted101846
1192KB
12ms
C2023 bytes2023-05-04 21:29:53
1021902022211301*Accepted65033
1072KB
15ms
C1930 bytes2023-05-04 21:29:50
1021892022211301*Accepted101846
1192KB
11ms
C2025 bytes2023-05-04 21:29:07