結果

問題 No.820 Power of Two
ユーザー sasa
提出日時 2025-03-17 11:03:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 8,732 KB
最終ジャッジ日時 2025-03-17 11:03:29
合計ジャッジ時間 4,057 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 2 TLE * 1 -- * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d%d",&N,&M);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(void){
	int N, M;
	scanf("%d%d",&N,&M);
	
	int count = 0;
	if(N == 0 || M == 0){
		printf("%d",count);
		return 0;
	}
	
	int A = 1;
	int B = 1;
	for(int i = 0;i < N;i ++){
		A *= 2;
	}
	for(int i = 0;i < M;i ++){
		B *= 2;
	}
	
	
	for(int i = 1;i <= A;i ++){
		if(i % B == 0){
			count++;
		}
	}
	printf("%d",count);
}
0