scanf("%i:%i", &gg, &mm) jest skuteczny,
zaś python też sobie nie radzi!!!
Dopisałem jeden znaczek i obrobiłem ręcznie
import sys
we, i = sys.stdin.read()+’_’, 0
def minuty():
- global i
- gg = 0
- while we[i]<‘0’ or we[i]>‘9’: i+=1
- while we[i]>=‘0’ and we[i]<=‘9’:
-
gg = gg*10 + ord(we[i]) - ord('0')
-
i += 1
- mm = 0
- while we[i]<‘0’ or we[i]>‘9’: i+=1
- while we[i]>=‘0’ and we[i]<=‘9’:
-
mm = mm*10 + ord(we[i]) - ord('0')
-
i += 1
-
#print(gg,’:’,mm)
- return gg*60 + mm
Czy da się to zrobić lepiej?