結果

問題 No.403 2^2^2
ユーザー akakimidori
提出日時 2017-05-07 16:49:38
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 14:48:44
合計ジャッジ時間 1,374 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:18:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |   scanf("%lld^%lld^%lld",&a,&b,&c);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

typedef long long int ln;

int modPow(ln r,int n,int mod){
  ln res=1;
  ln t=r;
  while(n>0){
    res=res*(n&0x01?t:1)%mod;
    t=t*t%mod;
    n>>=1;
  }
  return res;
}

void run(void){
  ln a,b,c;
  scanf("%lld^%lld^%lld",&a,&b,&c);
  const int mod=1000000007;

  int a_bc=modPow(a%mod,(int)((b%(mod-1))*c%(mod-1)),mod);
  int a_b_c=modPow(a%mod,modPow(b%(mod-1),c%(mod-2),mod-1),mod);
  printf("%d %d\n",a_bc,a_b_c);
  return;
}

int main(void){
  run();
  return 0;
}
0