結果

問題 No.820 Power of Two
ユーザー giru_yukikogiru_yukiko
提出日時 2019-05-27 21:18:14
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 336 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 30,464 KB
実行使用メモリ 10,684 KB
最終ジャッジ日時 2023-10-17 18:18:09
合計ジャッジ時間 6,759 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         fgets(buf,sizeof(buf),stdin);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>

main(){
	int index1,index2;
	int number=1;
	int ans=0;
	long long cmp[2];
	char buf[100];

	fgets(buf,sizeof(buf),stdin);
	sscanf(buf,"%d %d",&index1,&index2);

	cmp[0]=pow(2,index1);
	cmp[1]=number*pow(2,index2);
	while(cmp[1]<=cmp[0]){
		number++;
		ans++;
	}

	printf("%x\n",ans);
	return(0);
}
0