結果

問題 No.509 塗りつぶしツール
ユーザー h8d51n
提出日時 2017-04-28 23:20:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 18:33:54
合計ジャッジ時間 1,028 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s",s);
      |         ~~~~~^~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main(void){
	char s[16];
	int n;
	int len;
	int i;
	int ans;
	
	scanf("%s",s);
	len=strlen(s);
	ans=len*2;
	for(i=0;i<len;i++){
		n=(int)s[i]-(int)'0';
		if(n==1||n==2||n==3||n==5||n==7)ans+=0;
		else if(n==0||n==4||n==6||n==9)ans+=1;
		else ans+=2;
	}
	ans++;
	printf("%d\n",ans);
	
	return 0;
}
0