File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ . "fmt"
6
+ "io"
7
+ "math"
8
+ "strconv"
9
+ )
10
+
11
+ // github.com/EndlessCheng/codeforces-go
12
+ func CF1567D (in io.Reader , _w io.Writer ) {
13
+ out := bufio .NewWriter (_w )
14
+ defer out .Flush ()
15
+ var T , s , n int
16
+ for Fscan (in , & T ); T > 0 ; T -- {
17
+ Fscan (in , & s , & n )
18
+ x := int (math .Pow10 (len (strconv .Itoa (s )) - 1 ))
19
+ for i := 1 ; i < n ; i ++ {
20
+ for s - x < n - i {
21
+ x /= 10
22
+ }
23
+ Fprint (out , x , " " )
24
+ s -= x
25
+ }
26
+ Fprintln (out , s )
27
+ }
28
+ }
29
+
30
+ //func main() { CF1567D(os.Stdin, os.Stdout) }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/EndlessCheng/codeforces-go/main/testutil"
5
+ "testing"
6
+ )
7
+
8
+ // https://codeforces.com/problemset/problem/1567/D
9
+ // https://codeforces.com/problemset/status/1567/problem/D
10
+ func TestCF1567D (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 6
15
+ 97 2
16
+ 17 1
17
+ 111 4
18
+ 100 2
19
+ 10 9
20
+ 999999 3
21
+ outputCopy
22
+ 70 27
23
+ 17
24
+ 3 4 100 4
25
+ 10 90
26
+ 1 1 2 1 1 1 1 1 1
27
+ 999900 90 9`
28
+ testutil .AssertEqualCase (t , rawText , 0 , CF1567D )
29
+ }
You can’t perform that action at this time.
0 commit comments