Submission #45278574


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
long long s(string x,int k)
{
	long long res=1,ans=0,si=x.size();
	for(int i=si-1;i>=0;i--)
	{
		ans+=(x[i]-'0')*res;
		res*=k;
	}
	return ans;
}
long long k,ans;
int main()
{
	string a,b;
	cin>>k>>a>>b;
	ans=s(a,k)*s(b,k);
	cout<<ans<<'\n';
	return 0;
}

Submission Info

Submission Time
Task B - Base K
User CYB_Meow
Language C++ 17 (gcc 12.2)
Score 200
Code Size 319 Byte
Status AC
Exec Time 1 ms
Memory 3516 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 1 ms 3456 KiB
001.txt AC 1 ms 3516 KiB
002.txt AC 1 ms 3460 KiB
003.txt AC 1 ms 3488 KiB
004.txt AC 1 ms 3420 KiB
005.txt AC 1 ms 3512 KiB
006.txt AC 1 ms 3512 KiB
007.txt AC 1 ms 3516 KiB
example0.txt AC 1 ms 3488 KiB
example1.txt AC 1 ms 3516 KiB