QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189465 | #4867. So Easy! | zwp1234 | WA | 4ms | 3604kb | C++17 | 2.3kb | 2023-09-27 15:34:55 | 2023-09-27 15:34:56 |
Judging History
answer
//# pragma GCC optimize(2)
#include <bits/stdc++.h>
#define int long long
#define SZ(x) (int)(x).size()
#define fs first
#define sc second
#define PII pair<int,int>
#define ls(u) (u)<<1
#define rs(u) (u)<<1|1
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vi >
#define vI vector<PII>
#define db double
#define all(a) (a).begin(),(a).end()
#define lowbit(x) (x)&(-x)
#define die cout << "???" << endl
//#define endl '\n'
using namespace std;
const int mod = 998244353;
//const int mod = 1169996969;
//const int mod = 1e9 + 7;
//const int inf = LLONG_MAX;
const int inf = 1e17;
//const int inf = 1e9;
//const db PI = acos(-1.0);
const db eps = 1e-7;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e5+5,M = 2e6+5,K = 20;
inline int rd() {
int f = 0; int x = 0; char ch = getchar();
for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
if (f) x = -x;
return x;
}
void write(ll a) {if(a>=10)write(a/10);putchar(a%10+'0');}
void wt(ll a) {if(a < 0) {putchar('-');a = -a;}write(a);}
void wwt(ll a){wt(a);putchar('\n');}
// int mul(int x, int y, int p)
// {
// int z = (long double)x / p * y;
// ll res = (unsigned long long)x * y - (unsigned long long) z * p;
// return (res + p) % p;
// }
int n,m,k;
template<class T> inline bool smin(T &x,T y) {return x > y?x = y,1:0;}
template<class T> inline bool smax(T &x,T y) {return x < y?x = y,1:0;}
double modu(double a,int m)
{
int t = floor(a/m);
return a - t*m;
}
double fsm(double b,int p,int m)
{
double res = 1;
while(p)
{
if(p&1) res = res*b,res = modu(res,m);
b = b*b;
b = modu(b,m);
p >>= 1;
}
return res;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "r+", stdin);
freopen("out.txt", "w+", stdout);
#endif
int a,b;
while(cin >> a >> b >> n >> m)
{
double base = a + sqrt(b);
int ans = ceil(fsm(base,n,m));
ans %= m;
cout << ans << endl;
}
return 0;
}
// 26 26
// 34 34
// 23 36
// 34 43
// 31 31
詳細信息
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 3604kb
input:
2 3 1 2012 2 3 2 2012 2 2 1 2012 31603 998691525 860250282 20381 4062 16491843 2741468 17921 26061 679145378 8235021 22991 16225 263237214 865378598 7182 18902 357253267 137732528 3407 25414 645847050 674769818 7114 6903 47648125 254957745 1556 16577 274779382 158233677 1099 939 880815 990631973 610...
output:
4 14 4 11106 7481 13787 7128 19 2756 579 579 3551 23480 2715 597 6393 29890 8799 10499 1348 21046 455 8182 12475 1498 2294 12574 8621 2260 24722 7287 12747 14820 5314 14351 2148 44 6525 4127 3193 9009 6506 1055 9979 12196 4800 1221 25633 2445 10 19603 1179 1311 4813 1537 7911 3549 374 345 10766 1086...
result:
wrong answer 4th lines differ - expected: '16026', found: '11106'