結果

問題 No.118 門松列(2)
ユーザー Ysmr_Ry
提出日時 2015-01-09 23:49:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 427 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 06:51:18
合計ジャッジ時間 1,043 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf( "%d", &N );
      |         ~~~~~^~~~~~~~~~~~
main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |                 scanf( "%d", &A );
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

// yukicoder 118 (http://yukicoder.me/problems/221)
#include<cstdio>
#define rep(i,a) for(int i=0;i<(a);++i)

typedef long long ll;

const int MAX_N = 100000, mod = 1000000007;

int N;
ll cnt[101];

int main()
{
	scanf( "%d", &N );
	rep( i, N )
	{
		int A;
		scanf( "%d", &A );
		++cnt[A];
	}

	int ans = 0;
	rep( i, 101 ) rep( j, i ) rep( k, j )
		ans = (ans+cnt[i]*cnt[j]*cnt[k]) % mod;

	printf( "%d\n", ans );

	return 0;
}
0