# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
633185 | ahmed_shafik | Pot (COCI15_pot) | C++17 | 1 ms | 328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ahmed_is_fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define ld long double
#define cc(n) cout << n << "\n"
#define ccc(n) cout << n << ' '
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define f(a) a.first
#define s(a) a.second
#define lcm(a, b) (a * b) / __gcd(a, b)
#define sp(x) setprecision(x)
using namespace std;
void ahmed()
{
ll n;
cin>>n;
ll arr[n+9];
ll ans=0;
for(ll i=0; i<n; i++)
{
cin>>arr[i];
string s=to_string(arr[i]);
if(s.size()==2)
{
ll a=s[0]-'0';
ll b=s[1]-'0';
ll c=pow(a,b);
ans+=c;
}
else if(s.size()==3)
{
ll a=s[0]-'0';
ll b=s[1]-'0';
ll c=b+(a*10);
ll v=s[2]-'0';
ll x=pow(c,v);
ans+=x;
}
else
{
ll a=s[0]-'0';
ll b=s[1]-'0';
ll c=s[2]-'0';
ll d=c+(b*10)+(a*100);
ll v=s[3]-'0';
ll x=pow(d,v);
ans+=x;
}
}
cout<<ans<<endl;
}
bool AHMED = false;
int main()
{
ahmed_is_fast;
ll t = 1;
if (AHMED)
{
cin >> t;
}
while (t--)
{
ahmed();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |