QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#317904#4798. Floor Tiles in a Parkjames1BadCreeperWA 0ms3648kbC++141.3kb2024-01-29 21:54:202024-01-29 21:54:20

Judging History

你现在查看的是最新测评结果

  • [2024-01-29 21:54:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-01-29 21:54:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int P = 998244353; 

inline int poww(int a, int b) {
    int r = 1; 
    for (; b; b >>= 1, a = 1ll * a * a % P) if (b & 1) r = 1ll * r * a % P; 
    return r; 
}

int w, h, k; 

inline int C(int n, int m) {
    int ans = 1, ians = 1; 
    for (int i = n; i >= n - m + 1; --i) ans = 1ll * ans * i % P; 
    for (int i = 1; i <= m; ++i) ians = 1ll * ians * i % P;     
    return 1ll * ans * poww(ians, P - 2) % P; 
}

int main(void) {
    cin >> w >> h >> k; 
    if (k == 1) return cout << "1\n", 0; 
    if (k == 2) return cout << w + h - 2 << '\n', 0; 
    if (k == 3) {
        int ans = (C(w - 1, 2) + C(h - 1, 2)) % P; 
        ans = (ans + 4ll * (w - 1) * (h - 1) % P) % P; 
        cout << ans << '\n'; 
        return 0; 
    }
    if (k == 4) {
        int ans = (C(w - 1, 3) + C(h - 1, 3)) % P; 
        // (3 1) (1 3) (2 2) (2 2) 一条横线穿过去
        // 一条横线穿一个 3 
        // 一条横线穿两个 4
        ans = (ans + 1ll * (w - 1) * C(h - 1, 2) % P * 7) % P; 
        ans = (ans + 1ll * (h - 1) * C(w - 1, 2) % P * 7) % P; 
        ans = (ans + 1ll * (w - 1) * (h - 1)) % P; 
        cout << ans << '\n'; 
        return 0; 
    }
    
    return 0; 
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3648kb

input:

2 3 5

output:


result:

wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements