結果

問題 No.933 おまわりさんこいつです
コンテスト
ユーザー nii
提出日時 2019-11-29 21:53:24
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,310 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 745 ms
コンパイル使用メモリ 98,288 KB
最終ジャッジ日時 2026-05-15 03:19:15
合計ジャッジ時間 1,625 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:20:8: error: 'uint32_t' does not name a type
   20 | inline uint32_t Xor128(){
      |        ^~~~~~~~
main.cpp:15:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   14 | #include <fstream>
  +++ |+#include <cstdint>
   15 | using namespace std;
main.cpp: In member function 'int64_t Timer::getcycle()':
main.cpp:36:17: error: 'uint32_t' was not declared in this scope
   36 |                 uint32_t low,high;
      |                 ^~~~~~~~
main.cpp:36:17: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
main.cpp:37:48: error: 'low' was not declared in this scope; did you mean 'pow'?
   37 |                 __asm__ volatile ("rdtsc":"=a"(low),"=d"(high));
      |                                                ^~~
      |                                                pow
main.cpp:37:58: error: 'high' was not declared in this scope
   37 |                 __asm__ volatile ("rdtsc":"=a"(low),"=d"(high));
      |                                                          ^~~~

ソースコード

diff #
raw source code

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
const long long inf=1e9+7;
const long long mod=1e9+7;
const int64_t CYCLES_PER_SEC=2800000000;
//
inline uint32_t Xor128(){
	static uint32_t x=123456789;
	static uint32_t y=362436069;
	static uint32_t z=521288629;
	static uint32_t w=88675123;
	uint32_t t=x^(x<<11);
	x=y;y=z;z=w;
	return w=(w^(w>>19))^(t^(t>>8));
}
struct Timer{
	int64_t start;
	Timer(){reset();}
	void reset(){start=getcycle();}
	void plus(double a){start-=(a*CYCLES_PER_SEC);}
	inline double get(){return (double)(getcycle()-start)/CYCLES_PER_SEC;}
	inline int64_t getcycle(){
		uint32_t low,high;
		__asm__ volatile ("rdtsc":"=a"(low),"=d"(high));
		return ((int64_t)low)|((int64_t)high<<32);
	}
};
//
int n;
long long p[100000];
int sum(long long hoge){
	int s=0;
	while(hoge>0){
		s+=hoge%10;
		hoge/=10;
	}
	return s;
}
int main(){
	cin>>n;
	if(n==0){
		cout<<0<<endl;
		return 0;
	}
	long long ans=1;
	for(int i=0;i<n;i++){
		cin>>p[i];
		while(p[i]>=10){
			p[i]=sum(p[i]);
		}
		ans*=p[i];
		while(ans>=10){
			ans=sum(ans);
		}
	}
	cout<<ans<<endl;
	return 0;
}
0