結果
| 問題 | No.1232 2^x = x |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-08 13:16:34 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 7,951 bytes |
| 記録 | |
| コンパイル時間 | 8,426 ms |
| コンパイル使用メモリ | 426,008 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-08 13:16:44 |
| 合計ジャッジ時間 | 9,541 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 |
ソースコード
#ifdef LOCAL
#include "my_header.h"
#else
#define PRAGMA_OPTIMIZE(s) _Pragma(#s)
PRAGMA_OPTIMIZE(GCC optimize("Ofast"))
PRAGMA_OPTIMIZE(GCC optimize("unroll-loops"))//ループ
#pragma GCC optimize("fast-math","no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")//浮動小数点
//#pragma GCC target ("avx,avx2,fma")//四則演算
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
using minta=modint998244353;
using mintb=modint1000000007;
std::ostream&operator<<(std::ostream& os,minta v){os << v.val();return os;}
std::istream&operator>>(std::istream&is,minta &v){long long t;is >> t;v=t;return is;}
#endif
namespace for_debugging{
struct subscript_and_location{
int sub;
std::source_location loc;
template<class T> subscript_and_location(T sub_,std::source_location loc_=std::source_location::current()){
if(!std::is_integral<T>::value){
std::clog << loc_.file_name() << ":(" << loc_.line() << ":" << loc_.column() << "):" << loc_.function_name() << std::endl;
std::clog << "subscript is not integer: subscript = " << sub_ << std::endl;
exit(EXIT_FAILURE);
}
sub=sub_;
loc=loc_;
}
void check_out_of_range(size_t sz){
if(sub<0||(int)sz<=sub){
std::clog << loc.file_name() << ":(" << loc.line() << ":" << loc.column() << "):" << loc.function_name() << std::endl;
std::clog << "out of range: subscript = " << sub << ", vector_size = " << sz << std::endl;
exit(EXIT_FAILURE);
}
}
};
}
namespace std{
template<class T,class Allocator=std::allocator<T>> class vector_for_debugging:public std::vector<T,Allocator>{
using std::vector<T,Allocator>::vector;
public:
[[nodiscard]] constexpr std::vector<T,Allocator>::reference operator[](for_debugging::subscript_and_location n) noexcept(!std::is_same<T,bool>::value){
n.check_out_of_range(this->size());
return std::vector<T,Allocator>::operator[](n.sub);
}
[[nodiscard]] constexpr std::vector<T,Allocator>::const_reference operator[](for_debugging::subscript_and_location n) const noexcept(!std::is_same<T,bool>::value){
n.check_out_of_range(this->size());
return std::vector<T,Allocator>::operator[](n.sub);
}
};
namespace pmr{
template<class T> using vector_for_debugging=std::vector_for_debugging<T,std::pmr::polymorphic_allocator<T>>;
}
}
#define vfd vector_for_debugging
/*//多倍長整数
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
//仮数部が10進数で1024桁の浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/
#define rep(i,n) for(long long i=0;i<(long long)n;i++)
#define reps(i,n) for(long long i=1;i<=(long long)n;i++)
#define repi(i,n) for(int i=0;i<(int)n;i++)
#define loop(i,l,r) for(long long i=(long long)l;i<=(long long)r;i++)
#define loopi(i,l,r) for(int i=(int)l;i<=(int)r;i++)
#define drep(i,n) for(long long i=(long long)n-1;i>=0;i--)
#define drepi(i,n) for(int i=(int)n-1;i>=0;i--)
#define dreps(i,n) for(int i=(int)n;i>=1;i--)
#define dloop(i,l,r) for(long long i=(long long)l;i>=(long long)r;i--)
#define dloopi(i,l,r) for(int i=(int)l;i>=(int)r;i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yn(x) cout << (x? "Yes":"No") << endl;
#define cou(x) cout << x << endl;
#define emp emplace_back
#define mp make_pair
const long long moda=998244353LL;
const long long modb=1000000007LL;
const int kaz=1000000005;
long long yab=2500000000000000000LL;
const long long aho =-yab;
const long double eps=1.0e-14L;
const long double pi=acosl(-1.0L);
using ll=long long;
using st=string;
using P=pair<ll,ll>;
using tup=tuple<ll,ll,ll>;
using vi=vector<ll>;
using vin=vector<int>;
using vc=vector<char>;
using vb=vector<bool>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using sp=set<P>;
using si=set<ll>;
using vvi=vector<vector<ll>>;
using vvin=vector<vin>;
using vvc=vector<vc>;
using vvb=vector<vb>;
using vvvi=vector<vvi>;
using vvvin=vector<vvin>;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const vector<int> ex = {-1, -1, -1, 0, 0, 1, 1, 1};
const vector<int> ey = {-1, 0, 1, -1, 1, -1, 0, 1};
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2> v){os << '(' << v.first << ',' << v.second << ')';return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2> &v){is >> v.first >> v.second;return is;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
template<typename T>ostream&operator<<(ostream&os,vector<T>v){rep(i,v.size())os<<v[i]<<(i+1!=v.size()?" ":"\n");return os;}
template<typename T1,typename T2>
void co(bool x,T1 y,T2 z){
if(x)cout << y << endl;
else cout << z << endl;
}
long long isqrt(long long n){
long long ok=0,ng=1000000000;//1e9
while(ng-ok>1){
long long mid=(ng+ok)/2;
if(mid*mid<=n)ok=mid;
else ng=mid;
}
return ok;
}
template<typename T>
bool chmax(T &a, T b){
if(a<b){
a=b;
return true;
}
return false;
}
template <typename T, typename U>
T ceil(T x, U y) {
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
return (x > 0 ? x / y : (x - y + 1) / y);
}
template<typename T,typename U>
pair<pair<T,T>,T> unit(T x, T y,U k){
T s=floor(x-1,k);
T t=floor(y,k);
return make_pair(make_pair(s+1,t),1);
if(s==t)return make_pair(make_pair(0,0),-1);
}
pair<pair<ll,ll>,int> jufuku(ll a,ll b,ll c,ll d){
//a<=b,c<=dが保証されているとする
if(a>c){
swap(a,c);
swap(b,d);
}
if(c>b)return make_pair(make_pair(0,0),-1);
return make_pair(make_pair(c,min(b,d)),1);
}
template<typename T>
bool chmin(T &a, T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<typename T>
void her(vector<T> &a){
for(auto &g:a)g--;
}
ll mypow(ll x,ll y,ll MOD){
if(MOD==-1){
MOD=9223372036854775807LL;
}
ll ret=1;
while(y>0){
if(y&1)ret=ret*x%MOD;
x=x*x%MOD;
y>>=1;
}
return ret;
}
struct UnionFind {
vector<int> par,siz,mi,ma;
UnionFind(int n) : par(n,-1), siz(n,1) {mi.resize(n);ma.resize(n);iota(mi.begin(),mi.end(),0);iota(ma.begin(),ma.end(),0); }
int root(int x) {
if(par[x]==-1)return x;
else return par[x]=root(par[x]);
}
bool same(int x, int y) {
return root(x)==root(y);
}
bool marge(int x, int y) {
int rx = root(x), ry = root(y);
if (rx==ry) return false;
if(siz[rx]<siz[ry])swap(rx,ry);
par[ry] = rx;
siz[rx] += siz[ry];
mi[rx]=min(mi[rx],mi[ry]);
ma[rx]=max(ma[rx],ma[ry]);
return true;
}
int size(int x) {
return siz[root(x)];
}
int mini(int x){
return mi[root(x)];
}
int maxi(int x){
return ma[root(x)];
}
};
vector<long long> fac,finv,invs;
// テーブルを作る前処理
void COMinit(int MAX,int MOD) {
fac.resize(MAX);
finv.resize(MAX);
invs.resize(MAX);
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
invs[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
invs[i] = MOD - invs[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * invs[i] % MOD;
}
}
// 二項係数計算
long long binom(int n, int k,int MOD){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
#endif
int main(){
cin.tie(nullptr);
int n;cin>>n;
rep(i,n){
ll p;cin>>p;
if(p==2)cout << 2 << "\n";
else cout << (p-1)*(p-1) << "\n";
}
}