結果

問題 No.488 四角関係
ユーザー ふっぴー
提出日時 2017-04-06 22:05:30
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 21,888 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-17 21:41:41
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d %d",&n,&m);
      |         ^~~~~~~~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d %d",&a,&b);
      |                 ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	int n,m;
	scanf("%d %d",&n,&m);
	int node[50][50]={0};
	int i,j,k,l;
	int a,b;
	for(i=0;i<m;i++){
		scanf("%d %d",&a,&b);
		node[a][b]=1;
		node[b][a]=1;
	}
	int cnt=0;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(node[i][j]==1){
				for(k=0;k<n;k++){
					if(node[j][k]==1 && k!=i && node[i][k]!=1){
						for(l=0;l<n;l++){
							if(node[k][l]==1 && node[l][i]==1 && l!=j && node[l][j]!=1){
								cnt++;
							}
						}
					}
				}
			}
		}
	}
	cnt/=8;
	printf("%d\n",cnt);
	return 0;
}
0