結果
問題 | No.623 fudan no modulus to tigau |
ユーザー |
![]() |
提出日時 | 2018-01-11 05:29:40 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 630 bytes |
コンパイル時間 | 331 ms |
コンパイル使用メモリ | 21,888 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-23 17:13:43 |
合計ジャッジ時間 | 1,004 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:10:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:16:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d%d%d",t+i,a+i,b+i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:21:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%d",&q); | ^~~~~~~~~~~~~~ main.c:24:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%d",&x); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<stdlib.h>typedef long long int int64;const int mod=998244353;void run(void){int n;scanf("%d",&n);int t[51];int a[51];int b[51];int i;for(i=2;i<=n;i++){scanf("%d%d%d",t+i,a+i,b+i);}int64 f[51];f[0]=1;int q;scanf("%d",&q);for(i=1;i<=q;i++){int x;scanf("%d",&x);f[1]=x;int k;for(k=2;k<=n;k++){if(t[k]==1){f[k]=(f[a[k]]+f[b[k]])%mod;} else if(t[k]==2){f[k]=a[k]*f[b[k]]%mod;} else {f[k]=f[a[k]]*f[b[k]]%mod;}}printf("%lld\n",f[n]);}return;}int main(void){run();return 0;}