Submission #00043


ソースコード

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
#include<iostream>
using namespace std;
main(){
int n,a,i,j,f;
char bin[9];
cin>>n;
for(i=0;i<n;i++){
f=0;
cin>>a;
if(a<0){
f=1;
a=a*(-1);
}
for(j=7;j>=0;j--){
if(a%2==1)bin[j]='1';
else bin[j]='0';
a=a/2;
}
if(f==1){
for(j=0;j<8;j++){
if(bin[j]=='0')bin[j]='1';
else bin[j]='0';
}
for(j=7;;j--){
if(bin[j]=='1')bin[j]='0';
else{
bin[j]='1';
break;
}
}
}
for(j=0;j<8;j++){
cout<<bin[j];
}
cout<<endl;
}
}

ステータス

項目 データ
問題 0002 - プロ技
ユーザー名 ei1516
投稿日時 2015-10-28 17:50:19
言語 C++11
状態 Accepted
得点 100
ソースコード長 567 Byte
最大実行時間 18 ms
最大メモリ使用量 700 KB

セット

セット 得点 Cases
1 ALL 100 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
s1.txt AC 18 ms 476 KB
1
s2.txt AC 10 ms 700 KB
1
s3.txt AC 11 ms 552 KB
1