提出 #39756140


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
#define IOS ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


typedef tree<int,null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update>order_set;
typedef pair<int,int>pr;
#define all(i)     i.begin() , i.end()
#define ft     first
#define sn     second
#define pb push_back


#define en "\n"
#define dbg cout<<"rony\n";

#define MAXN 2010
#define inf 1e8
const int mod = 998244353;

int n,m;
vector<int>g[MAXN];
int an;

ll bigmod(ll a,ll n,ll m)
{
    if(n == 0) return 0;
    ll A = 0;
    if(n%2 == 0)
    {
        A = (a + 1) * bigmod((a*a)%m,n/2,m);
    }
    else{
        A = 1 + a * bigmod(a,n-1,m);
    }
    return A % m;
}
void solve()
{
  ll a,x,m;
  cin >> a >> x >> m;

  ll an = bigmod(a,x,m);
  cout<<an<<en;
}
int main()
{
    IOS;
   int t;
   t = 1;
    // cin >> t;
   int c = 0;
    while ( t-- )
    {
        // cout<<"Case "<<++c<<": ";
        solve();
    }
    return 0;
}   

提出情報

提出日時
問題 E - Geometric Progression
ユーザ ar_rony1
言語 C++ (GCC 9.2.1)
得点 500
コード長 1168 Byte
結果 AC
実行時間 7 ms
メモリ 3648 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:59:8: warning: unused variable ‘c’ [-Wunused-variable]
   59 |    int c = 0;
      |        ^

ジャッジ結果

セット名 Sample All AfterContest
得点 / 配点 0 / 0 500 / 500 0 / 0
結果
AC × 3
AC × 31
AC × 1
セット名 テストケース
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt
AfterContest after_contest_01.txt
ケース名 結果 実行時間 メモリ
after_contest_01.txt AC 7 ms 3552 KiB
sample00.txt AC 2 ms 3600 KiB
sample01.txt AC 2 ms 3596 KiB
sample02.txt AC 2 ms 3648 KiB
testcase00.txt AC 2 ms 3548 KiB
testcase01.txt AC 2 ms 3628 KiB
testcase02.txt AC 2 ms 3592 KiB
testcase03.txt AC 2 ms 3540 KiB
testcase04.txt AC 2 ms 3592 KiB
testcase05.txt AC 2 ms 3624 KiB
testcase06.txt AC 2 ms 3564 KiB
testcase07.txt AC 2 ms 3616 KiB
testcase08.txt AC 2 ms 3548 KiB
testcase09.txt AC 2 ms 3556 KiB
testcase10.txt AC 2 ms 3616 KiB
testcase11.txt AC 2 ms 3564 KiB
testcase12.txt AC 2 ms 3568 KiB
testcase13.txt AC 2 ms 3592 KiB
testcase14.txt AC 2 ms 3592 KiB
testcase15.txt AC 2 ms 3544 KiB
testcase16.txt AC 2 ms 3628 KiB
testcase17.txt AC 2 ms 3620 KiB
testcase18.txt AC 2 ms 3600 KiB
testcase19.txt AC 2 ms 3552 KiB
testcase20.txt AC 2 ms 3620 KiB
testcase21.txt AC 2 ms 3556 KiB
testcase22.txt AC 2 ms 3628 KiB
testcase23.txt AC 2 ms 3612 KiB
testcase24.txt AC 4 ms 3648 KiB
testcase25.txt AC 2 ms 3548 KiB
testcase26.txt AC 2 ms 3596 KiB
testcase27.txt AC 2 ms 3568 KiB