http://www.dengwenhuo.cn/?id=194
Given a2×2 matrix
findA n whereA 1 =A,A n =A×A n−1 . As the result may be large, you are going to find only the remainder after division by7 .
Special Note: The problem is intended to be easy. Feel free to think why the problem is called 2016
if you either:
find it hard to solve;
or, solved all the other problems easily.
The input contains at most40 sets. For each set:
The first line contains an integern (1≤n<10 100000 ).
The second line contains2 integersa 11 ,a 12 .
The third line contains2 integersa 21 ,a 22 .
(0≤a ij <7 ,(a 11 a 22 −a 12 a 21 ) is not a multiple of7 )
For each set, a2×2 matrix denotes the remainder ofA n after division by7 .
2 1 1 1 2 2016 1 1 1 2
2 3 3 5 1 0 0 1
#pragma comment(linker, "/STACK:102400000,102400000")
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include