Submission #32378
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #include <stdio.h> #include <string.h> /*-------------------------------------------------- CMYK形式はシアン、マゼンタ、イエロー、ブラックの四色を意味していて 主に印刷物で使われているらしいです 昔はシアン、マゼンタ、イエローを混ぜて黒を作っていたけれど 色が濁る上にインク代がかさむから黒インクを追加したんだとか ---------------------------------------------------*/ int main() { int color; int chushutsu; int up; int n; char com[10]; int shift[] = {16, 8, 0}; int mask[] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; scanf ( "%X" , &color); do { scanf ( "%s" , com); if ( strcmp (com, "update" ) == 0 ) { for ( int i = 0; i < 3; i++) { scanf ( "%d" , &up); if ( up != -1 ) { color = color & (~mask[i]); color = color | (up << shift[i]); } } } if ( strcmp (com, "disp" ) == 0 ) { printf ( "%06X\n" , color); } if ( strcmp (com, "shift" ) == 0 ) { scanf ( "%d" , &n); if ( n > 0 ) { color = color >> n; } else if ( n < 0 ) { color = color << (-1 * n); color = color & mask[3]; } } if ( strcmp (com, "reverse" ) == 0 ) { for ( int i = 0; i < 3; i++ ) { chushutsu = (color & mask[i]) >> shift[i]; up = 255 - chushutsu; color = color & (~mask[i]); color = color | (up << shift[i]); } } } while ( strcmp (com, "quit" ) != 0 ); return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0900 - あーるじーびー操作 |
ユーザー名 | ei1710 |
投稿日時 | 2018-03-24 15:18:28 |
言語 | C |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 1629 Byte |
最大実行時間 | 45 ms |
最大メモリ使用量 | 3488 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
input01 | AC | 33 ms | 608 KB |
1
|
input02 | AC | 26 ms | 796 KB |
1
|
input03 | AC | 35 ms | 1112 KB |
1
|
input04 | AC | 28 ms | 1032 KB |
1
|
input05 | AC | 31 ms | 1208 KB |
1
|
input06 | AC | 28 ms | 1264 KB |
1
|
input07 | AC | 34 ms | 1576 KB |
1
|
input08 | AC | 40 ms | 1760 KB |
1
|
input09 | AC | 45 ms | 2208 KB |
1
|
input10 | AC | 38 ms | 2524 KB |
1
|
input11 | AC | 40 ms | 2704 KB |
1
|
input12 | AC | 19 ms | 2664 KB |
1
|
input13 | AC | 24 ms | 2820 KB |
1
|
input14 | AC | 21 ms | 3008 KB |
1
|
input15 | AC | 38 ms | 3192 KB |
1
|
input16 | AC | 44 ms | 3372 KB |
1
|
input_sample1 | AC | 21 ms | 3432 KB |
1
|
input_sample2 | AC | 19 ms | 3488 KB |
1
|
input_sample3 | AC | 18 ms | 3444 KB |
1
|
input_sample4 | AC | 20 ms | 3468 KB |
1
|