fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PA05_POT___Czy_umiesz_potęgować
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int D = Convert.ToInt32(Console.ReadLine());
  14. int wynik=1;
  15.  
  16. for (int i = 0; i < D; i++)
  17. {
  18. int liczbaJednosci = 1;
  19. string[] liczby = Console.ReadLine().Split(' ');
  20. int a = Convert.ToInt32(liczby[0]);
  21. int b = Convert.ToInt32(liczby[1]);
  22.  
  23. for (int j = 1; j < b; j++)
  24. {
  25. liczbaJednosci = liczbaJednosci * a;
  26. string conv = Convert.ToString(liczbaJednosci);
  27. int ileZnakow = conv.Length;
  28. wynik = liczbaJednosci * Convert.ToInt32(conv[ileZnakow - 1]);
  29.  
  30. }
  31. string pom;
  32. pom = Convert.ToString(wynik);
  33. int ileZankowPom = pom.Length;
  34. Console.WriteLine(pom[ileZankowPom-1]);
  35. }
  36.  
  37.  
  38. Console.ReadLine();
  39. }
  40. }
  41. }
  42.  
Success #stdin #stdout 0s 131520KB
stdin
2
2 2
3 3
stdout
0
3