implementation math number theory *1000

Please click on ads to support us..

Python Code:

n = int(input())

lst = [6,8,4,2]

if n == 0:
    print(1)
else:
    print(lst[n%4])

C++ Code:

#include <bits/stdc++.h>
#include<iostream>
#define ll long long
#define endl '\n'
#define F first
#define S second
#define ld long double
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) (x * y) / gcd(x, y)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#include <string>
#define pp push_back()
using namespace std;
int arr[104]={0};
vector<pair<int,int> >p1;
vector<char>vc;
vector<int>v1,v2;
vector<string>str1,str2,str3;
set<int>s;
map<char,int>mp;

string s1,s2,s3,s4,s5,str4;
int sum=0,prod=1,k=0,q=0,t=0,mini=0,maxi=0,c=0;
bool tt=true,ff=false;
void zeroes(vector<int>ve,int n){
  for(int i=0;i<n;i++)ve[i]=0;
}

bool cmp(pair<int, int>& a,
pair<int, int>& b)
{
return  a.second < b.second;
}
int find_OR(int arr[],int n){
    int ans=0;
    for(int i=0;i<n;i++)ans=(ans|arr[i]);
    return ans;
}
void DS(){
    fast
    int n;
    cin>>n;
    int a[4]={6,8,4,2};
    if(n==0)cout<<1;
    else cout<<a[n%4];
}
int main()
{
    DS();

    return 0;
}


Comments

Submit
0 Comments
More Questions

281A - Word Capitalization
1646A - Square Counting
266A - Stones on the Table
61A - Ultra-Fast Mathematician
148A - Insomnia cure
1650A - Deletions of Two Adjacent Letters
1512A - Spy Detected
282A - Bit++
69A - Young Physicist
1651A - Playoff
734A - Anton and Danik
1300B - Assigning to Classes
1647A - Madoka and Math Dad
710A - King Moves
1131A - Sea Battle
118A - String Task
236A - Boy or Girl
271A - Beautiful Year
520B - Two Buttons
231A - Team
479C - Exams
1030A - In Search of an Easy Problem
158A - Next Round
71A - Way Too Long Words
160A - Twins
1A - Theatre Square
1614B - Divan and a New Project
791A - Bear and Big Brother
1452A - Robot Program
344A - Magnets