E sum

来源:互联网 发布:看high类似软件 编辑:程序博客网 时间:2024/05/29 04:55
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=110042#problem/E

密码nefu

#include <iostream>  #include <cstring>  using namespace std;  const int MAXN = 1e5+5;  const int MOD = 1e9+7;  typedef long long LL;  LL quick_mod(LL a, LL b, LL m)  {      LL ans = 1;      while(b)      {          if(b&1)              ans = ans*a%m;          b>>=1;          a = a*a%m;      }      return ans;  }  LL GetMod(char st[])  {      LL ret = 0;      int len = strlen(st);      for(int i=0; i<len; i++)          ret = (ret*10+(st[i]-'0')) % (MOD-1);      ret--;      return ret;  }  char str[MAXN];  int main()  {      while(cin>>str)      {          LL tmp = GetMod(str);          cout<<quick_mod(2, tmp, MOD)<<endl;      }      return 0;  }  

 

0 0
原创粉丝点击