#include <stdio.h>

int main() { int m, n, i, j, count; scanf("%d", &m); while (m--) { scanf("%d", &n); count = 0; for (i = 0; i <= n; i += 2) { // 枚举地砖的数量,步长为2 count += (n - i) / 2 + 1; // 计算每种地砖数量对应的铺法数量 } printf("%d\n", count); } return 0; }

铺桥方案计算 - C语言实现

原文地址: https://www.cveoy.top/t/topic/oYEr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录