Problem:


小数位の和

a, b, n は、いずれも正の整数であるとします。分数 a / b の小数第 i 位の数を f(i) とします (0 ≤ f(i) ≤ 9)。このとき、i = 1 から n までの f(i) の和を s とします。

s = f(1) + f(2) + ... + f(n)

a, b, n を読み込んで、 s を出力して終了するプログラムを作成してください。

Input

入力は複数のデータセットからなります。各データセットとして、3 つの整数 a (1 ≤ a ≤ 1000), b (1 ≤ b ≤ 10000), n (1 ≤ n ≤ 100) が空白区切りで１行に与えられます。

データセットの数は 100 を超えません。

Output

データセットごとに、s を１行に出力します。

Sample Input

1 2 3
2 3 4
5 4 3
4 3 2

Output for the Sample Input

5
24
7
6



Sample input:
1 2 3
2 3 4
5 4 3
4 3 2


Sample output:
5
24
7
6

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a, b, n = list(map(int ,input().split(" ")))
		val = ("{0:." + str(n + 1) + "f}").format(a / b)
		ans = sum(list(map(int, list(str(val)[2:-1]))))
		print(ans)
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a, b, n = list(map(int ,input().split(" ")))
		val = ("{0:." + str(n + 2) + "f}").format(a / b)
		ans = sum(list(map(int, list(str(val)[2:-2]))))
		print(ans)
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
 try:
  sum(map(int, format(input()/float(input()), ".11f").split(".")[1])[:input()])
 except:
  break;

Submission status: Wrong Answer

Solution code:
import sys
for s in sys.stdin:
    a,b,n = map(int,s.split())
    c = float(a)/float(b)
    d = 0
    for i in xrange(n):
        c -= int(c)
        c *= 10
        d += int(c)
    print d

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

for line in f:
    a, b, n = map(int, line.split())
    s = 0
    ab = a / b
    for i in range(n):
        ab *= 10
        s += int(ab) % 10
    print(s)

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

for line in f:
    a, b, n = map(int, line.split())
    print(sum(map(int, list('{:.9f}'.format(a / b).split('.')[1])[:n])))

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

for line in f:
    a, b, n = map(int, line.split())
    print(sum(map(int, list('{:.10f}'.format(a / b).split('.')[1])[:n])))

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

for line in f:
    a, b, n = map(int, line.split())
    s = 0
    for i in range(n):
        a = a * 10
        s += int(a / b) % 10
    print(s)

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    for i in s[s.index(".")+1:2+n]:
        sum += int(i)

    print(sum)

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    x = s.index(".")+1
    for i in s[x:2+x]:
        sum += int(i)

    print(sum)

Submission status: Wrong Answer

Solution code:
def f(num, i, tmp):
    for k in xrange(10):
        if k * 10**(-i) <= num - tmp < (k + 1) * 10**(-i):
            return k
            break

a,b,n = map(int,raw_input().split())
a = float(a)
s = 0
tmp = f(a/b,0,0) 
for i in range(1,n+1):
    val = f(a/b, i, tmp)
    s += val
    tmp += float(val * 10 ** (-i))
print s

Submission status: Wrong Answer

Solution code:
ls = raw_input()
ls = ls.split()

st = str(int(ls[0]) / float(ls[1]))
s = 0
for i in st[2:]:
	s += int(i)

print s

Submission status: Wrong Answer

Solution code:
while 1:
	try:
		ls = raw_input()
		ls = ls.split()
	
		st = str(float(ls[0]) / float(ls[1]))
		print st
		s = 0
		for i in st[2:int(ls[2]) + 2]:
			s += int(i)

		print s
	except:
		break

Submission status: Wrong Answer

Solution code:
while 1:
	try:
		ls = raw_input()
		ls = ls.split()
	
		st = str(float(ls[0]) / float(ls[1]))
		s = 0
		for i in st[2:int(ls[2]) + 2]:
			s += int(i)

		print s
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		num = raw_input().split(" ")
		sum = 0
		x = float(num[0]) / float(num[1])
		if x < 1:
			x = x + 1.0
		for var in range(1, int(num[2]) + 1):
			sum += int(str(x * 10**var)[var:var+1])
			
		print sum
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		num = raw_input().split(" ")
		sum = 0
		x = float(num[0]) / float(num[1])
		if x < 1.0:
			x = x + 1.0
		for var in range(1, int(num[2]) + 1):
			sum += int(str(x * 10**var)[var:var+1])
			
		print sum
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		num = raw_input().split(" ")
		sum = 0
		x = float(num[0]) / float(num[1])
		if x < 1.0:
			x = x + 1.0
		for var in range(1, int(num[2]) + 1):
			sum += long(str(x * 10**var)[var:var+1])
			
		print sum
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= float(b)
		for var in range(1, n + 1):
			a *= 10
			s += int(a % 10)
		print s
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= float(b)
		for var in range(1, n + 1):
			a *= 10
			s += int(a) % 10
		print s
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= float(b)
		for var in range(0, n):
			a *= 10
			s += int(a) % 10
		print s
	except:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= float(b)
		for var in range(0, n):
			a *= 10
			s += int(a) % 10
		print s
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= b * 1.0
		for var in range(0, n):
			a *= 10
			s += int(a) % 10
		print s
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= b * 1.0
		for var in range(0, n):
			a *= 10
			s += a % 10
		print int(s)
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
		s = 0
		a /= b * 1.0
		for var in range(0, n):
			a *= 10
			s += int(a % 10)
		print s
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
	except EOFError:
		break
	s = 0
	a /= b * 1.0
	for var in range(0, n):
		a *= 10
		s += int(a % 10)
	print s

Submission status: Wrong Answer

Solution code:
t=10**9
while 1:
    try:
        a,b,n=map(int,raw_input().split())
        f=a*t/b
        f=str(f%t)
        ans=0
        for i in range(n):
            ans+=int(f[i])
        print ans
    except:
        break

Submission status: Wrong Answer

Solution code:
t=10**9
while 1:
    try:
        a,b,n=map(int,raw_input().split())
        if b==0:
            print 0
            continue
        f=a*t/b
        f=str(f%t)
        ans=0
        for i in range(n):
            ans+=int(f[i])
        print ans
    except:
        break

Submission status: Wrong Answer

Solution code:
t=10**10
while 1:
    try:
        a,b,n=map(int,raw_input().split())
        if b==0:
            print 0
            continue
        f=a*t/b
        f=str(f%t)
        ans=0
        for i in range(n):
            ans+=int(f[i])
        print ans
    except:
        break

Submission status: Wrong Answer

Solution code:
t=10**10
while 1:
    try:
        a,b,n=map(int,raw_input().split())
        if b==0:
            print 0
            continue
        f=a*t/b
        f=str(f%t)
        ans=0
        for i in range(n):
            try:
                ans+=int(f[i])
            except:
                break
        print ans
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys
for line in sys.stdin:
	ans = 0
	a,b,c = map(float, line.split())
	x = str(a/b)
	for i in xrange(2,int(c)+2):
		try:
			ans += int(x[i])
		except: pass
	print ans

Submission status: Wrong Answer

Solution code:

import sys
for line in sys.stdin:
	ans = 0
	a,b,c = map(float, line.split())
	x = str(a/b)
#	print x,int(x[2:int(c)+2])
	for i in xrange(2,int(c)+2):
		try:
			ans += int(x[i])
		except: pass
	print ans

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

for line in sys.stdin:
    a, b, n = map(int, line.split())
    sum = 0
    c = float(a)/b
    if c > 1:
        c -= int(c)
    for i in range(n+1):
        sum += int(c)
        c -= int(c)
        c *= 10
    print sum

Submission status: Wrong Answer

Solution code:
while True:
    try:
        Sum = 0
        a,b,n = map(int,input().split())
        for i in range(1,n + 1):
            Sum += int((((a/b) * (10 ** i))) % 10)
        print(Sum)
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
while(1):
    try:
        [a,b,n]=map(int,raw_input().split())
        ans=0
        for i in range(n):
            ans+=int(float(a)/b*10**(i+1))%10
        print ans
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n=map(int,input().split())
    except:
        break
    tmp=[int(i) for i in str(a*(10**100)//b)]
    if a<b:
        print(sum(tmp[:n]))
    else:
        print(sum(tmp[1:n+1]))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n=map(int,input().split())
    except:
        break
    tmp=[int(i) for i in str(a*(10**101)//b)]
    if a<b:
        print(sum(tmp[:n]))
    else:
        print(sum(tmp[1:n+1]))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n=map(int,input().split())
    except:
        break
    tmp=[int(i) for i in str(a*(10**110)//b)]
    if a<b:
        print(sum(tmp[:n]))
    else:
        print(sum(tmp[1:n+1]))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n=map(int,input().split())
    except:
        break
    tmp=[int(i) for i in str(a*(10**110)//b)]
    t=len(str(a//b))
    if a<b:
        print(sum(tmp[:n]))
    else:
        print(sum(tmp[t:n+t]))

Submission status: Wrong Answer

Solution code:
a = []
b = []
n = []
while True:
    try:
        tmp = list(input().split())
        a.append(int(tmp[0]))
        b.append(int(tmp[1]))
        n.append(int(tmp[2]))
    except EOFError:
        break

for i in range(len(a)):
    f = float(a[i]/b[i])
    s = 0
    for j in range(n[i]):
        f = f*10
        s += int(f)%10
    print(s)

Submission status: Wrong Answer

Solution code:
import re
while True:
    try:
        a,b,n = map(int, input().strip().split())
        s = re.sub(r'^\d*\.', '', '%.100f' % (a/b))
        d =s[:n]
        print(sum(map(int,list(d))))

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import re
while True:
    try:
        a,b,n = map(int, input().strip().split())
        s = re.sub(r'[^\.]*\.', '', '%.100f' % (a/b))
        d =s[:n]
        print(sum(map(int,list(d))))

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import re
while True:
    try:
        a,b,n = map(int, input().strip().split())
        s = re.sub(r'^[^\.]*\.', '', '%.100f' % (a/b))
        d =s[:n]
        print(sum(map(int,list(d))))

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import re
while True:
    try:
        a,b,n = map(int, input().strip().split())
        s = re.sub(r'^[^\.]*\.', '', '%.100f' % float(a/b))
        d =s[:n]
        print(sum(map(int,list(d))))

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import math
while True:
    try:
        a,b,n = map(int, input().strip().split())
        s,t = math.modf(a/b)
        u = '%.100f' % s
        d =u[2:n+2]
        print(sum(map(int,list(d))))

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import math
while True:
    try:
        a,b,n = map(int, input().strip().split())
        u = '%.100f' % (float(a)/b)
        i = u.index('.')
        d =u[i+1:i+1+n]
        print(sum(map(int,list(d))))

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import re
while True:
    try:
        a,b,n = map(int, input().strip().split())
        u = '%.100f' % (float(a)/b)
        v = list(re.sub(r'[^\.]*\.', '', u))[:n]
        w = sum(map(int,v))
        print(w)

    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
# Aizu Problem 0054: Sum of Nth Decimal Places
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


for line in sys.stdin:
    a, b, n = [int(_) for _ in line.split()]
    frac = str(round(a / b, 10)).split('.')[1]
    print(sum([int(d) for d in frac[:n]]))

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    oneset = list(map(int,input().split()))
    sums = 0
    for i in range(oneset[2]):
        k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
        sums = sums + (k % 10)
    ans.append(sums)
    
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

for line in sys.stdin:
    a, b, n = map(int, line.split())
    s = 0
    for j in range(n):
        s += int(pow(10, j + 1) * a / b) % 10
    print(s)

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
for i in range(len(ans)):
    print((ans[i]))

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
        
for i in range(len(ans)-1):
    print((ans[i]))

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
        
for i in range(len(ans)):
    print(int((ans[i])))

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
        
ansl = ''
for i in range(len(ans)):
    if i != len(ans) -1:
        ansl = ansl + str(ans[i]) + '\n'
    else:
        ansl = ansl + str(ans[i])
        
print(ansl)

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] * (10 ** (i + 1) / oneset[1] ) )))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
        
ansl = ''
for i in range(len(ans)):
    if i != len(ans) -1:
        ansl = ansl + str(ans[i]) + '\n'
    else:
        ansl = ansl + str(ans[i])
        
print(ansl)

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] * (10 ** (i + 1) / oneset[1] ) )))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
        
ansl = ''
for i in range(len(ans)):
    if i != len(ans) -1:
        ansl = ansl + str(ans[i]) + ' \n'
    else:
        ansl = ansl + str(ans[i]) + ' '
        
print(ansl)

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
    try:
        oneset = list(map(int,line.split()))
        sums = 0
        for i in range(oneset[2]):
            k = int(m.floor((oneset[0] * ((10 ** (i + 1)) / oneset[1] ) )))
            sums = sums + (k % 10)
        ans.append(sums)
    except:
        break
    if line == '':
        break
        
ansl = ''
for i in range(len(ans)):
    if i != len(ans) -1:
        ansl = ansl + str(ans[i]) + '\n'
    else:
        ansl = ansl + str(ans[i]) 
print(ansl)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import math

for line in sys.stdin:
    a, b, n = map(int, line.split())
    s = 0
    for j in range(n):
        s += math.floor(pow(10, j + 1) * a / b) % 10
    print(s)

Submission status: Wrong Answer

Solution code:
import sys
import math as m
ans = []
for line in sys.stdin:
  
    oneset = list(map(int,input().split()))
    sums = 0
    for i in range(oneset[2]):
        k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
        sums = sums + (k % 10)
    ans.append(sums)
    print(sums)

Submission status: Wrong Answer

Solution code:
from decimal import *
import sys
ndp=lambda i,j,k:sum(map(int,str(Decimal(str(i))/Decimal(str(j))).split(".")[-1][:k]))
l=[list(map(int,l.split())) for l in sys.stdin]
[print(ndp(i[0],i[1],i[2])) for i in l]

Submission status: Wrong Answer

Solution code:
from decimal import *
import sys
getcontext().prec=100
ndp=lambda i,j,k:sum(map(int,str(Decimal(str(i))/Decimal(str(j))).split(".")[-1][:k]))
l=[list(map(int,l.split())) for l in sys.stdin]
[print(ndp(i[0],i[1],i[2])) for i in l]

Submission status: Wrong Answer

Solution code:
from decimal import *
import sys
getcontext().prec=120
ndp=lambda i,j,k:sum(map(int,str(Decimal(str(i))/Decimal(str(j))).split(".")[-1][:k]))
l=[list(map(int,l.split())) for l in sys.stdin]
[print(ndp(i[0],i[1],i[2])) for i in l]

Submission status: Wrong Answer

Solution code:
import sys
for a, b, n in (map(int, l.split()) for l in sys.stdin.readlines()):
    if a >= b:
        a -= b
    a *= 10
    ans = 0
    for _ in [0]*n:
        d, m = divmod(a, b)
        ans += d
        a = m*10
    print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

for line in stdin:
    a, b, n = (int(s) for s in line.split())
    ab = a / b
    result = 0
    for i in xrange(1, n+1):
        result += int(ab * (10 ** i)) % 10
    print(result)

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
    a, b, n = map(int, s.split())
    print sum(map(int, '{:.10f}'.format(a*1.0 / b).split('.')[1][:n]))

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
	a = s.split()
	b = '{0:.10f}'.format(float(a[0]) / float(a[1])).split('.')[1]
	print sum(map(int,list(b))[:int(a[2]):])

Submission status: Wrong Answer

Solution code:
getNum = lambda x, a : int(x / 10 ** a % 10)

while 1:
        str = raw_input()
        str.split()

        if len(str) != 5:
                exit()

        firstnum  = float(str[0])
        secondnum = float(str[2])
        therdnum  = int(str[4])

        ans = sum([getNum(firstnum/secondnum, -x) for x in range(1, therdnum+1)])

        print ans

Submission status: Wrong Answer

Solution code:
getNum = lambda x, a : int(x / 10 ** a % 10)

while 1:
        str = raw_input()
        if str == 0:
                break
        str.split()

        if len(str) != 5:
                exit()

        firstnum  = float(str[0])
        secondnum = float(str[2])
        therdnum  = int(str[4])

        ans = sum([getNum(firstnum/secondnum, -x) for x in range(1, therdnum+1)])

        print ans

Submission status: Wrong Answer

Solution code:
getNum = lambda x, a : int(x / 10 ** a % 10)

while 1:
        str = raw_input()
        if str == 0:
                break
        str.split()

        if len(str) != 5:
                break

        firstnum  = float(str[0])
        secondnum = float(str[2])
        therdnum  = int(str[4])

        ans = sum([getNum(firstnum/secondnum, -x) for x in range(1, therdnum+1)])

print ans

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str(float(a)/b-a/b) + "000000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print sum
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str(float(a)/b-a/b) + "000000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print s
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str(float(a)/b-a/b) + "0000000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print s
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str(float(a)/b-a/b) + "000000000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print s
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str(float(a)/b-a/b) + "00000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print s
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str((a+0.0)/b-a/b) + "00000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print s
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        f = str((a+0.0)/(b+0.0)-a/b) + "00000000"
        s= 0
        for i in range(n):
            s += int(f[i+2])
        print s
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,n = map(int, raw_input().split())
        s = 0
        for i in range(n):
            a = a%b*10
            s += 1/b
        print s
    except:
        break

Submission status: Accepted

Solution code:
from fractions import Fraction
import sys

for s in sys.stdin:
    a,b,n = map(int,s.split())
    c = Fraction(a,b)
    d = 0
    for i in xrange(n):
        d += int(c*10**(i+1)) % 10
    print d

Submission status: Accepted

Solution code:
import sys
f = sys.stdin

for line in f:
    a, b, n = map(int, line.split())
    s = 0
    for i in range(n):
        a = a % b * 10
        s += a // b % 10
    print(s)

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    x = s.index(".")+1
    for i in s[x:x+n]:
        sum += int(i)

    print(sum)

Submission status: Accepted

Solution code:
while True:
	try:
		a,b,n = map(int,raw_input().split())
	except EOFError:
		break
	s = 0
	for var in range(0, n):
		a = a % b * 10
		s += a / b
	print s

Submission status: Accepted

Solution code:
while 1:
    try:
        a,b,n=map(int,raw_input().split())
        s=0
        for i in range(n):
            a=a%b*10
            s+=a/b
        print s
    except:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break
    print(sum(a * 10 ** (i + 1) // b % 10 for i in range(n)))

Submission status: Accepted

Solution code:
import sys

def get_n(a,b,n,s):
  if n == 0:
    return s
  else:
    i = int(((a/b)-(a//b))*10)
    s += i
    return get_n(a*10,b,n-1,s)

for line in sys.stdin:
  a,b,n = list(map(int,line.split()))
  s = get_n(a,b,n,0)
  print(s)

Submission status: Accepted

Solution code:
while True:
    try:
        s = 0
        a,b,n = map(int,input().split())
        ama = a % b
        for i in range(1,n + 1):
            s += int((ama * 10)/ b)
            ama = (ama * 10) % b
        print(s)
    except EOFError:
        break

Submission status: Accepted

Solution code:
while(1):
    try:
        [a,b,n]=map(int,raw_input().split())
        ans=0
        for i in range(n):
            k=(a*10**(i+1)/b)%10
            ans+=k
        print ans
    except:
        break

Submission status: Accepted

Solution code:
while 1:
    try: a,b,c=map(int,input().split())
    except:break
    print(sum(a*10**(i+1)//b%10 for i in range(c)))

Submission status: Accepted

Solution code:
a = []
b = []
n = []
while True:
    try:
        tmp = list(input().split())
        a.append(int(tmp[0]))
        b.append(int(tmp[1]))
        n.append(int(tmp[2]))
    except EOFError:
        break

for i in range(len(a)):
    s = 0
    for j in range(n[i]):
        f = a[i]*(10**(j+1))
        s += (f//b[i])%10
    print(s)

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,n=map(int, input().split())
        s = str(a/b).split('.')[1]
        for _ in range(len(s), n): s+='0'
        print(sum([int(s[i]) for i in range(n)]))
    except:break

Submission status: Accepted

Solution code:
import re
while True:
    try:
        a,b,n = map(int, input().strip().split())
        u = str((float(a)/b))
        v = list(re.sub(r'[^\.]*\.', '', u))[:n]
        w = sum(map(int,v))
        print(w)

    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        A,B,N = map(int,input().split())
    except EOFError:
        break
    A %= B
    ans = 0
    for i in range(N):
        A *= 10
        ans += A // B
        A %= B
    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os

for s in sys.stdin:
    a, b, n = map(int, s.split())
    lst = []
    r = a % b
    for i in range(100):
        v = 10 * r // b
        r = 10 * r % b
        lst.append(v)
    print(sum(lst[:n]))

Submission status: Accepted

Solution code:
while True:
	try:
		a,b,n = [eval(x) for x in input().split()]
		_,fra = str(a/b).split('.') if '.' in str(a/b) else '0'
		print(sum([eval(fra[i]) for i in range(n if n <= len(fra) else len(fra))]))
	except EOFError:
		break

Submission status: Accepted

Solution code:
import sys




def solve(a, b, n):
    result = 0
    a = a % b
    for i in range(n):
        a *= 10
        result += a // b
        a = a % b
    return result




if __name__ == '__main__':
    # ??????????????\?????¨???????????????
    for line in sys.stdin:
        a, b, n = [int(x) for x in line.strip().split(' ')]
        result = solve(a, b, n)
        print(result)

Submission status: Accepted

Solution code:
# Aizu Problem 0054: Sum of Nth Decimal Places
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


for line in sys.stdin:
    a, b, n = [int(_) for _ in line.split()]
    frac = str(round(a / b, n+2)).split('.')[1]
    print(sum([int(d) for d in frac[:n]]))

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    print(sum(map(int, ' '.join(str(a / b).split('.')[1][:n]).split())))

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, n = map(int, input().split())
        c = str(a/b)[str(a/b).find(".") + 1:]
        ans = 0
        for i in range(len(c)):
            ans += int(c[i])
            if i + 1 == n:
                break
        print(ans)
    except:
        break

Submission status: Accepted

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):
    a,b,n = [int(i) for i in N[l].split()]
    a = a % b
    a = a * (10**n)
    a = a // b
    ans = 0
    while a > 0:
        ans += a % 10
        a = a // 10
    print(ans)

Submission status: Accepted

Solution code:
import sys
for e in sys.stdin:
 a,b,n=map(int,e.split())
 print(sum(a*10**(i+1)//b%10 for i in range(n)))

Submission status: Accepted

Solution code:
import sys
for e in sys.stdin:
 a,b,n=map(int,e.split())
 print(sum(a*10**i//b%10 for i in range(1,n+1)))

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,n=map(int,input().split())
    except EOFError:
        break
    a%=b
    ans=0
    for i in range(n):
        a*=10
        ans+=a//b#//は切り捨て除算
        a%=b
    print(ans)

Submission status: Accepted

Solution code:
import sys
for line in sys.stdin:
    a, b, n = map(int, line.split())
    c = a/b % 1
    sn = str(c)[2:].zfill(n)
    sum = 0
    for i in range(n):
        sum += int(sn[i])
    print(sum)

Submission status: Accepted

Solution code:
while True:
  try:
    a, b, n = map(int, input().split())
    
    ans = 0

    #10倍して1の位の数を足していく
    for i in range(n):
      a *= 10
      ans += (a // b) % 10

    print(ans)

  except EOFError:
    break

Submission status: Accepted

Solution code:
from decimal import *
import sys
getcontext().prec=120
ndp=lambda i,j,k:sum(map(int,str("{:.100f}".format(Decimal(str(i))/Decimal(str(j)))).split(".")[-1][:k]))
l=[list(map(int,l.split())) for l in sys.stdin]
[print(ndp(i[0],i[1],i[2])) for i in l]

Submission status: Accepted

Solution code:
# AOJ 0054 Sum of Nth decimal places
# Python3 2018.6.16 bal4u

while True:
	try:
		a, b, n = list(map(int, input().split()))
	except EOFError:
		break
        
	sum = 0
	a %= b
	for i in range(n):
		if a == 0: break
		a *= 10
		sum += a // b
		a %= b
	print(sum)

Submission status: Accepted

Solution code:
import sys
for a, b, n in (map(int, l.split()) for l in sys.stdin.readlines()):
    if a >= b:
        a %= b
    a *= 10
    ans = 0
    for _ in [0]*n:
        d, m = divmod(a, b)
        ans += d
        a = m*10
    print(ans)

Submission status: Accepted

Solution code:
import sys
for line in sys.stdin.readlines():
    a,b,n=map(int,line.strip().split())
    s=str((a+0.0)/(b+0.0)).ljust(9,"0").split(".")[1]
    print sum([int(i) for i in s[0:n]])

Submission status: Accepted

Solution code:

import sys


def solv(a, b, n):
    x = list(str(float(a) / float(b) - a / b))[2:]
    x = map(int, x)
    if n <= len(x):
        return sum(x[:n])
    else:
        return sum(x)


for line in sys.stdin:
    a, b, n = tuple(map(int, line.split(' ')))
    print solv(a, b, n)