結果
問題 | No.142 単なる配列の操作に関する実装問題 |
ユーザー |
![]() |
提出日時 | 2015-07-14 23:54:00 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 871 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 16,032 KB |
最終ジャッジ日時 | 2024-07-08 07:32:35 |
合計ジャッジ時間 | 14,260 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 1 TLE * 1 -- * 3 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d %d %d %d %d", &n, &s, &x, &y, &z); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:26:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d", &q); | ^~~~~~~~~~~~~~~ main.c:31:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | scanf("%d %d %d %d", &sq, &tq, &uq, &vq); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>int a[2000010]={0};void printArr(int n){int i;for(i=1;i<=n;i++){printf("%d ", a[i]);}printf("\n");}int main(void){int i;int n, s,x,y,z;int q;scanf("%d %d %d %d %d", &n, &s, &x, &y, &z);a[1] = s;for(i=2;i<=n;i++){long long int tmp = (x*a[i-1]+y)%z;a[i] = (int)tmp;}scanf("%d", &q);for(i=0;i<q;i++){char dir = 1;int sq, tq, uq, vq;scanf("%d %d %d %d", &sq, &tq, &uq, &vq);if(sq < uq && uq <= tq && tq <= vq){dir = -1;}if(dir == 1){int dsu, duv;for( dsu=sq, duv=uq ; dsu <= tq ; dsu++, duv++){a[duv] = (a[dsu] + a[duv])%10;}}else{int dsu, duv;for( dsu=tq, duv=vq ; dsu >= sq ; dsu--, duv--){a[duv] = (a[dsu] + a[duv])%10;}}}for(i=1;i<=n;i++){if(a[i]&1){printf("O");}else{printf("E");}}printf("\n");return 0;}