結果

問題 No.2203 POWER!!!!!
ユーザー vjudge1
提出日時 2025-02-16 23:29:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 193,016 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-16 23:29:06
合計ジャッジ時間 2,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:16:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |                 scanf("%d",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const int MAX=2e5+10;
int a[MAX];
int main()
{
	int n,i,j,cnt[11],sd;
	ll ans;
	scanf("%d",&n);
	memset(cnt,0,sizeof cnt);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	ans=0;
	for(i=1;i<=n;i++)
	{
		sd=1;
		for(j=1;j<=8;j++)
		{
			sd*=a[i];
			ans+=1LL*sd*cnt[j];
		}
	}
	printf("%lld\n",ans);
	return 0;
}
0