討論串[問題] 九九乘法表不用迴圈是叫我直接從1列到81?
共 29 篇文章
內容預覽:
我知道這樣子程式跑得慢了點,但是大家是在斯文寫考卷又不是在火拚對吧. 一秒印一行,大不了 64 秒也是印得完,而且都在睡也沒浪費 CPU time. 啊就真的沒有用到迴圈,我用 alarm() 去推動也是會動. 最後面用 getchar() 來等待,原因是 sleep() 會被 signal 打斷,
(還有1308個字)
內容預覽:
C++17 新功能 static-if 根據 compile time constant 展開. 不勞煩大家讀難懂的 meta-template programming 版本了. #include <cstdio>. template <int n> int f(){. if constexpr(n
(還有162個字)
內容預覽:
#include <cstdio>. int main(int n, char* []) {. if (n == 82) return 0;. printf("%2d x %2d = %2d\n",(n-1)/9+1,(n-1)%9+1,((n-1)/9+1)*((n-1)%9+1));. main
(還有85個字)
內容預覽:
被嗆我難過,回家反省,確定這個直接 template-meta 的版本沒人給過. #include <cstdio>. template <int N, int M> struct p {. static void foo() {. printf("%2d x %2d = %2d\n", N, M,
(還有355個字)
內容預覽:
好魔性的題目,我好像中毒了,連睡夢中都會夢到新的解法. 我發誓我沒有用迴圈,我用的是 stdlib 的函式,至於 stdlib 用了啥我不知情. (黑心企業標準臺詞). /* https://ideone.com/J3JKj5 */. #include <stdio.h>. #include <st
(還有452個字)