結果
| 問題 | No.142 単なる配列の操作に関する実装問題 |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2015-12-13 18:50:10 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 2,150 ms / 5,000 ms |
| コード長 | 524 bytes |
| 記録 | |
| コンパイル時間 | 143 ms |
| コンパイル使用メモリ | 30,660 KB |
| 最終ジャッジ日時 | 2026-02-23 20:02:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
2 | n,p,s,x,y,z,i,j;
| ^
main.c: In function ‘main’:
main.c:6:1: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
6 | scanf("%d%d%d%d%d",&n,&s,&x,&y,&z);
| ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | unsigned a[70000],temp[4000];
ソースコード
unsigned a[70000],temp[4000];
n,p,s,x,y,z,i,j;
long t;
main(){
scanf("%d%d%d%d%d",&n,&s,&x,&y,&z);
a[0]=s&1<<1;t=s;
for(i=2;i<=n;i++){
t=(t*x+y)%z;
a[i>>5]|=(t&1)<<(i&31);
}
scanf("%*d");
for(;~scanf("%d%d%d%*d",&s,&x,&y);){
x-=s-1;
p=s&31;z=32-p;
for(i=0,j=s>>5;i<<5<x;i++,j++){temp[i]=a[j]>>p;p?temp[i]|=a[j+1]<<z:0;}
z=32-(x&31);
temp[i-1]=temp[i-1]<<z>>z;
p=y&31;z=32-p;
for(i=0,j=y>>5;i<<5<x;i++,j++){a[j]^=temp[i]<<p;p?a[j+1]^=temp[i]>>z:0;}
}
for(i=1;i<=n;i++)putchar((a[i>>5]>>(i&31))&1?'O':'E');
return 0;
}
testestest