12345678910111213141516171819202122232425262728293031323334353637383940 |
- package kata
- func SuMin(m int) int64 {
- var i, j, s int64
- n := int64(m)
- for i = 1; i <= n; i++ {
- for j = 1; j <= n; j++ {
- if i <= j {
- s += i
- } else {
- s += j
- }
- }
- }
- return s
- }
- func SuMax(m int) int64 {
- var i, j, s int64
- n := int64(m)
- for i = 1; i <= n; i++ {
- for j = 1; j <= n; j++ {
- if i >= j {
- s += i
- } else {
- s += j
- }
- }
- }
- return s
- }
- func SumSum(m int) int64 {
- var i, j, s int64
- n := int64(m)
- for i = 1; i <= n; i++ {
- for j = 1; j <= n; j++ {
- s += i + j
- }
- }
- return s
- }
|