백준 1009 c++

magicdrill·2024년 2월 22일
0

백준 문제풀이

목록 보기
13/654

백준 1009 c++

#include <iostream>

using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int T, i, a, b, j, temp = 1;

	cin >> T;
	for (i = 0; i < T; i++)
	{
		cin >> a >> b;
		for (j = 0; j < b; j++)
		{
			temp = (temp * a) % 10;
		}

		if (temp == 0)
		{
			cout << "10\n";
		}
		else
		{
			cout << temp << "\n";
		}
		temp = 1;
	}

	return 0;
}

0개의 댓글