6 条题解

  • 0
    @ 2026-7-6 1:39:12

    我们可以直接调用系统函数获知输入文件大小,减去 22 得到答案,将时间复杂度降至 O(1)O(1)!

    #include <stdio.h>
    #include <fcntl.h>
    #include <sys/stat.h>
    #include <unistd.h>
    int main()
    {
    	struct stat st;
    	fstat(open("log.in", O_RDONLY), &st);
    	freopen("log.out", "w", stdout);
    	printf("%ld\n", st.st_size - 2);
    	return 0;
    }
    
    • @ 2026-10-7 20:52:37

      但是我们需要输出 O(log⁡log⁡n)O(\log \log n) 个字符,所以是 O(log⁡log⁡n)O(\log \log n) 的(???)

信息

ID
2
时间
1000ms
内存
512MiB
难度
2
标签
递交数
118
已通过
25
上传者