zoukankan      html  css  js  c++  java
  • HackerRank

    The punch line to this problem is the support to very very large int handling. I tried C++ code for multiple times, but it only passed first 13~ cases.

    Then I tried Ruby and got it passed all:

    meta = gets.chomp
    nm = meta.split(' ')
    n = nm.first.to_i
    m = nm.last.to_i
    
    total = 0
    for i in 0..m-1
       triple = gets.chomp
       vs = triple.split(' ')
       vs = vs.map(&:to_i)
       total += vs[2] * (vs[1] - vs[0] + 1)   
    end
    
    puts total / n

    However, there are a bunch of all-passing C++ solutions. I also used 'long long' actually... weird

  • 相关阅读:
    Mysql探索之索引详解,又能和面试官互扯了~
    POJ 1163
    POJ 1157
    POJ 1143
    POJ 1164
    HDU 2553
    POJ 1321
    POJ 1125
    POJ 2488
    POJ 3083
  • 原文地址:https://www.cnblogs.com/tonix/p/4303333.html
Copyright © 2011-2022 走看看