Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e9ddf07

Browse files
Adding more context
1 parent 11a4ff1 commit e9ddf07

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

‎Problem Solving Scripts/CPF_Checker.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
2121
SAMPLE CPF: 113.314.390-35
2222
23+
TO GET FIRST DIGIT FORM LAST SECTION:
24+
2325
1*10 = 10
2426
1*9 = 9
2527
3*8 = 24
@@ -30,8 +32,33 @@
3032
9*3 = 27
3133
0*2 = 0
3234
33-
DIGITS SUM: 1 +たす 1 +たす 3 +たす 3 +たす 1 +たす 4 +たす 3 +たす 9 +たす 0 +たす 3 +たす 5 = 33
3435
TOTAL: 10 +たす 9 +たす 24 +たす 21 +たす 6 +たす 20 +たす 12 +たす 27 +たす 0 +たす 0 = 129
36+
GET THE REST FROM RESULT => 129 % 11 = 10
37+
38+
IF RESULT > 9, DIGIT IS 0, ELSE DIGIT IS RESULT.
39+
40+
TO GET SECOND DIGIT FORM LAST SECTION:
41+
42+
1*11 = 11
43+
1*10 = 10
44+
3*9 = 27
45+
3*8 = 21
46+
1*7 = 7
47+
4*6 = 18
48+
3*5 = 15
49+
9*4 = 36
50+
0*3 = 0
51+
3*2 = 6
52+
53+
TOTAL: 11 +たす 10 +たす 27 +たす 21 +たす 7 +たす 18 +たす 15 +たす 36 +たす 0 +たす 6 = 151
54+
GET THE REST FROM RESULT => 151%11 = 5
55+
56+
BONUS:
57+
58+
If the sum pair of all 11 digits are the same, the CPF is invalid.
59+
60+
EXAMPLE:
61+
DIGITS SUM: 1 +たす 1 +たす 3 +たす 3 +たす 1 +たす 4 +たす 3 +たす 9 +たす 0 +たす 3 +たす 5 = 33 => Is valid.
3562
3663
"""
3764

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /