結果

問題 No.441 和か積
コンテスト
ユーザー tj_0612
提出日時 2016-11-18 01:00:14
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 629 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 113 ms
コンパイル使用メモリ 29,768 KB
最終ジャッジ日時 2026-02-23 22:54:38
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:19:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%s %s",A,B);
      |         ^~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>
#include <string.h>


int func(char *a){
	int i;
	i = atoi(a);
	if(i == 0)
		return 1;
	else if(i == 1)
		return 1;
	else
		return 0;
}

int main(){
	char A[201],B[201];

	scanf("%s %s",A,B);
	int Alen,Blen;
	Alen = strlen(A);
	Blen = strlen(B);

	if(Alen == 1 && Blen == 1){
		int a,b;
		a=atoi(A);
		b=atoi(B);
		if(a+b>a*b)
			printf("S\n");
		else if(a*b>a+b)
			printf("P\n");
		else 
			printf("E\n");
	} else if(Alen ==1){
		if(func(A)==1)
			printf("S\n");
		else
			printf("P\n");
	} else if(Blen ==1){
		if(func(B)==1)
			printf("S\n");
		else
			printf("P\n");
	} 
	else printf("P\n");

	return 0;
}
0