fork(1) download
  1. program ideone;
  2.  
  3. var TestCount,I,Mul,Sum:Integer;
  4. var pesel:String;
  5. begin
  6. ReadLn(TestCount);
  7. while TestCount>0 do
  8. begin
  9. Dec(TestCount);
  10. ReadLn(pesel);
  11. Sum:=0;
  12. for I:=1 to Length(pesel) do Inc(Sum,(Ord(pesel[I])-Ord('0'))*((I*2-1)mod(10)));
  13. WriteLn(Sum);
  14. end;
  15. end.
Success #stdin #stdout 0s 276KB
stdin
2
44051401458
12345678901
stdout
150
226