結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー yuho0819
提出日時 2016-09-04 13:24:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 776 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 789,020 KB
最終ジャッジ日時 2024-11-15 20:11:21
合計ジャッジ時間 48,689 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 14 TLE * 14 MLE * 4 OLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&a);
      |         ~~~~~^~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d",&s[i]);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int c[100000000];
int main(void)

{
	int a,s[3],d[9],f,g,h,i,j,z,x;
	scanf("%d",&a);
	for(i=0;i<a;i++)	c[i]=0;
	for(i=0;i<3;i++){
		scanf("%d",&s[i]);
	}
	z=0;
	h=3;
	for(i=0;i<2;i++){
		for(j=i+1;j<3;j++){
			if(s[i]!=s[j]){
				d[z]=s[i]*s[j];
				z++;
			}
			if(s[i]==s[j]){
				h--;
				s[i]=2100000000;
			}
		}
	}
	if(s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2])
		d[z]=s[0]*s[1]*s[2];
	x=0;
	for(i=0;i<h;i++){
		g=1;
		while(1){
			printf("%d %d %d\n",s[i],g,s[i]*g);
			if(s[i]*g>a){
				break;
			}
			if(c[s[i]*g]==0){
				x++;
				c[s[i]*g]++;
			}
			g++;
		}
	}
	printf("1 %d\n",x);
/*	for(i=0;i<=z;i++){
		g=0;
		while(1){
			printf("2  %d %d\n",d[i],d[i]*g);
			if(d[i]*g>a){
				break;
			}
			x--;
			g++;
		}
	}*/
	printf("%d\n",x);
	return 0;
}
		
0