Advertisement
Kode_Omut

Untitled

Dec 6th, 2019
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.48 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.  
  7.     var a,f,n,b int
  8.     fmt.Scan(&a)
  9.     b = 1
  10.     f = a
  11.     n = 1
  12.     for i := 0; a != 0; i++ {
  13.     fmt.Scan(&a)
  14.         if a > f {
  15.  
  16.             n = n - 1            
  17.             f = a
  18.             n = n + 1
  19.        
  20.         } else if a == f {
  21.        
  22.             if b == 1 {
  23.             b = b - 1
  24.             }
  25.             n = n + 1
  26.        
  27.         }
  28.        
  29.    
  30.     }
  31.    
  32.     fmt.Println(n)
  33.    
  34.    
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement