Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <vector>
- using namespace std;
- bool eof=false;
- const int _multiple=45,buff_size=0x8000;
- char buffer[buff_size];
- int index=0;
- vector <int> sol{0, 1, 5, 2, 8, 3, 9, 2, 8, 7, 7, 8, 4, 7, 3, 8, 4, 1, 5, 4, 4, 5, 9, 6, 2, 7, 3, 6, 2, 1, 1, 2, 8, 1, 7, 2, 8, 5, 9, 8, 8, 9, 3, 0, 6, 1, 7, 0, 6, 5, 5, 6, 2, 5, 1, 6, 2, 9, 3, 2, 2, 3, 7, 4, 0, 5, 1, 4, 0, 9, 9, 0, 6, 9, 5, 0, 6, 3, 7, 6, 6, 7, 1, 8, 4, 9, 5, 8, 4, 3, 3, 4, 0, 3, 9, 4, 0, 7, 1, 0, 0};
- class parser{
- public:
- parser() {}
- parser(const char *file_name){
- input_file.open(file_name);
- input_file.sync_with_stdio(false);
- cursor=0;
- input_file.read(buffer,SIZE);}
- inline parser &operator >>(int &n){
- int last,current;
- while(buffer[cursor]<'0' or buffer[cursor]>'9') inc();
- n=last=current=0;
- while('0'<=buffer[cursor] and buffer[cursor]<='9'){
- last=current;
- current=buffer[cursor]-'0';
- inc();
- }
- n=sol[last*10+current];
- return *this;}
- private:
- ifstream input_file;
- static const int SIZE=0x8000;
- char buffer[SIZE];
- int cursor=0;
- inline void inc(){
- if(++cursor==SIZE)
- cursor=0,input_file.read(buffer,SIZE);
- }
- };
- parser f ("cifra.in");
- ofstream t ("cifra.out");
- int main()
- {
- int n;
- cin>>n;
- for (int aux,i=0;i<n;++i){
- f>>aux;
- t<<aux<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement