Cod sursa(job #1221817)

Utilizator patrick_vladPatrick Vlad patrick_vlad Data 21 august 2014 15:14:05
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.11 kb
#include <math.h>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#define MAX 1500000
#define zeci (now / 10) % 10
#define unit now % 10
#define m7 (7 * ((now / 10) % 10))
using namespace std;
    ifstream f1 ("cifra.in");
    ofstream f2 ("cifra.out");
    /*int u2[4] = {6, 2, 4, 8};
    int u3[4] = {1, 3, 9, 7};
    int u4[2] = {6, 4};
    int u7[4] = {1, 7, 9, 3};
    int u8[4] = {6, 8, 4, 2};
    int u9[2] = {1, 9};*/
    int uI[10] = {0, 1, 5, 2, 8, 3, 9, 2, 8, 7};
    int uII[10] = {0, 1, 7, 0, 6, 1, 7, 4, 8, 7};
    int vect[100] = {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};
int main(){
    int t, i;
    char n[100];
    f1>>t;
    for(i = 0; i < t; i++){
        f1>>n;
        int now = atoi(n);
        f2<<vect[now%100]<<"\n";
        //int now = i;
        /*if(zeci % 2 == 0){
            f2<<(uI[unit] + m7) % 10<<",";
        } else {
            f2<<(uII[unit] + m7) % 10<<",";
        }*/
    }
    return 0;
}