czemu ten kod nie działa robiłem próby w ideone i było dobrze
#include
using namespace std;
int sum,v;
long long x;
int tabl[12];
int g (int t,int n);
int main()
{
cin>>v;
for(int j=0; j<v; ++j)
{
cin>>x;
for (int i=0; i<11; ++i)
{
tabl[i]=x%10;
sum+=g (tabl[i],i);
x=(x-tabl[i])/10;
if (i==10)
{
if(sum%10==0 && sum!=0 )
{
cout<<"D"<<endl;
sum=0;
x=0;
}
else
{
cout<<"N"<<endl;
sum=0;
x=0;
}
}
}
}
return 0;
}
int g (int t,int n)
{
n=n+1;
switch(n)
{
case 1:
case 5:
case 9:
case 11:
return t ;
break;
case 2:
case 6:
case 10:
return t*3 ;
break;
case 3:
case 7:
return t*7 ;
break;
case 4 :
case 8:
return t*9 ;
break;
default:
/*cout<<"Error";*/
return 0;
break;
}
}