इसे टाइप करने में कितना समय लगता है?


10

परिचय

मैं QWERTY कीबोर्ड लेआउट का उपयोग करके एक मध्यम गति से टाइप कर सकता हूं। लेकिन अगर येलवुडवुड जैसे शब्द में एक टन दोहराया गया अक्षर है, तो इसे टाइप करने में थोड़ा अधिक समय लगता है। इससे भी बदतर तब होता है जब "कूद" जैसे शब्द में एक ही उंगली का उपयोग कई अलग-अलग अक्षरों के लिए किया जाता है।

यहां बताया गया है कि मुझे प्रत्येक उंगली पर अक्षर लिखने में कितना समय लगता है (बहुत अवैज्ञानिक रूप से मापा गया):

कॉलम उंगली का नाम, कीस्ट्रोक्स / सेकंड, सेकंड / कीस्ट्रोक और प्रत्येक उंगली द्वारा उपयोग की जाने वाली कुंजी हैं

Typing same letter twice:       
L Pinky 5.2 0.1923076923 1qaz
L Ring  5   0.2          2wsx
L Mid   5.3 0.1886792453 3edc
L Index 5.5 0.1818181818 4rfv5tgb
R Thumb 6.5 0.1538461538 [space]
R Index 6.9 0.1449275362 6yhn7ujm
R Mid   6.3 0.1587301587 8ik,
R Ring  6.2 0.1612903226 9ol.
R Pinky 6.1 0.1639344262 0p;'

Typing different letter on same finger:     
L Pinky 4.6 0.2173913043
L Ring  4.6 0.2173913043
L Mid   4.5 0.2222222222
L Index 5.3 0.1886792453
R Index 5.4 0.1851851852
R Mid   5.1 0.1960784314
R Ring  5.2 0.1923076923
R Pinky 5.2 0.1923076923

CSV प्रारूप में समान डेटा ।

यह

.75 * (first_finger_same_letter_time + second_finger_same_letter_time) / 2

दो उंगलियों के बीच स्विच करने का समय।

चुनौती

इनपुट के रूप में एक स्ट्रिंग को देखते हुए, इसे टाइप करने में कितना समय लगता है?

  • "टाइमर" उस क्षण को शुरू करता है जिसे पहली कुंजी दबाया जाता है और अंतिम कुंजी दबाने पर समाप्त होता है। आप कीपेस के बीच का समय गिन रहे हैं।
  • यह । बाइट्स जीत में सबसे छोटा जवाब।
  • सबमिशन एक पूर्ण कार्यक्रम या फ़ंक्शन हो सकता है।
  • इनपुट और आउटपुट किसी भी तरह से आप इसे चाहते हैं , stdin / out, function params, file, कोई फर्क नहीं पड़ता।
  • आउटपुट कम से कम 3 दशमलव स्थानों के लिए सटीक होना चाहिए (+/- 0.001 राउंडिंग त्रुटि के लिए ठीक है)। 1 के तहत संख्या के लिए 0. अग्रणी और न्यूलाइन वैकल्पिक को पीछे छोड़ रहा है।
  • इनपुट एक स्ट्रिंग होगी जिसमें (लोअरकेस) az, 0-9, स्पेस, सेमीकोलन, अल्पविराम, अवधि और एपोस्ट्रोफ शामिल हैं।
  • मैं हमेशा अपने दाहिने अंगूठे के साथ रिक्त स्थान टाइप करता हूं।
  • मैं सामान्य स्पर्श टाइपिंग उंगलियों का उपयोग करता हूं (आप उंगली-कुंजी मैपिंग के लिए उपरोक्त तालिका भी देख सकते हैं)।
  • संदर्भ कोड का उपयोग परीक्षण मामलों को उत्पन्न करने के लिए किया जाता है

परीक्षण के मामलों

(खाली स्ट्रिंग या कोई एक वर्ण स्ट्रिंग) - 0.000

aa - 0.192

fff - 0.364

fj - 0.123

the quick brown fox jumped over the lazy dog - 5.795

yellowwooddoor - 1.983

orangewooddoor - 1.841

jump on it, jump on it - 2.748

type on it, type on it - 2.549

abcdefghijklmnopqrstuvwxyz01234567890 ;,.' - 5.746

ok, this may not be the most accurate but it's in the ballpark, maybe within 30 percent or so. - 12.138


क्या हम मान सकते हैं कि इनपुट कम से कम 2 वर्ण का होगा, या 0यदि इनपुट खाली है या एकल वर्ण है तो क्या हमें आउटपुट की आवश्यकता है ?
केविन क्रूज़सेन

पहले से ही कुछ जवाब हैं जो इसे संभालते हैं, इसलिए आधे रास्ते में नियमों को बदलने नहीं जा रहे हैं
डैनियल एम।

4
एक नए प्रकार का कोड गोल्फ: बाइट काउंट के आधार पर स्कोरिंग उत्तरों के बजाय, विजेता वह है जो कोई भी अपने प्रोग्राम को सबसे तेज टाइप कर सकता है।
12Me21

जवाबों:


7

जावास्क्रिप्ट (Node.js) , 180 बाइट्स

s=>(B=Buffer)(s).map(p=c=>(b='23841410645532207643205431765001333746443'[c*45%91%73%41]*2,t+=1/p?p-b?3/8*(g(b)+g(p)):g(b|c!=s):0,p=b,s=c),t=0,g=x=>10/B('4.2.5-75E6?3>4=4AA')[x])&&t

इसे ऑनलाइन आज़माएं!

कैसे?

देरी से भंडारण

हेल्पर फंक्शन एक पूर्णांक और सेकंड में देरी देता है।जी0एक्स17

g = x => 10 / Buffer('4.2.5-75E6?3>4=4AA')[x]

इनपुट या तो होने की उम्मीद है:एक्स

  • एक ही अक्षर के लिए देरी पाने के लिए दो बार बिन नंबर
  • अलग-अलग अक्षरों के लिए देरी पाने के लिए दो बार बिन नंबर + 1

वास्तव में स्ट्रिंग में जो संग्रहित किया जाता है वह '4.2.5-75E6?3>4=4AA'कीस्ट्रोक्स की संख्या प्रति सेकंड गुणा और ASCII में परिवर्तित होता है। आसानी से, सभी परिणामी अक्षर प्रिंट करने योग्य हैं।10

उदाहरण के लिए, को संग्रहीत किया जाता है जो कि है ।5.2chr(52)'4'

एक चरित्र को एक कुंजी बिन में परिवर्तित करना

हम निम्नलिखित हैश समारोह का उपयोग एक ASCII कोड में परिवर्तित करने में बिन संख्या से युक्त एक लुकअप तालिका में एक सूचकांक करने के लिए :सी[0..8]

मैं=(((सी×45)आधुनिक91)आधुनिक73)आधुनिक41

मुख्य घेरा

कुल समय साथ अद्यतन किया जाता है:टी

t +=                        // add to t:
  1 / p ?                   //   if p is numeric:
    p - b ?                 //     if p is not equal to b:
      3 / 8 * (g(b) + g(p)) //       0.75 * (g(b) + g(p)) / 2
    :                       //     else:
      g(b | c != s)         //       g(b) if c == s or g(b + 1) otherwise
  :                         //   else (first iteration):
    0                       //     leave t unchanged

जहां पिछला बिन है और पिछला चरित्र है।पीरों


4

जेली , 78 बाइट्स

“bk¶ŀqṣṁq*E’b25+45s2
Øq;"““;“,.'”Zṙ-ØD;"s2ẎW$€3,4¦ẎœiⱮQḢ€ị¢QƑịZƊQ3.75⁵Ḋ?÷$SµƝS

इसे ऑनलाइन आज़माएं!

कैसे?

“...’b25+45s2 - Link 1, keystrokes per 10 seconds: no arguments
“...’         - base 250 integer = 379310849477441257135820
     b25      - to base 25 = [16,7,7,1,5,1,8,0,10,8,24,9,18,6,17,7,20]
        +45   - add 45 = [61,52,52,46,50,46,53,45,55,53,69,54,63,51,62,52,65]
           s2 - split into twos
              - = [[61,52],[52,46],[50,46],[53,45],[55,53],[69,54],[63,51],[62,52],[65]]
             - For: 0...    1...    2...    3...    4...    6...    8...    9...    space

Øq;"““;“,.'”Zṙ-ØD;"s2ẎW$€3,4¦ẎœiⱮQḢ€ị¢QƑịZƊQ3.75⁵Ḋ?÷$SµƝS - Main Link: list of characters
                                                      µƝ  - for each neighbouring pair:
Øq                                                        -   qwerty = ["qwertyuiop","asdfghjkl","zxcvbnm"]
    ““;“,.'”                                              -   list of lists = ["",";",",.'"]
   "                                                      -   zip with:
  ;                                                       -     concatenate = ["qwertyuiop","asdfghjkl;","zxcvbnm,.'"]
            Z                                             -   transpose = ["qaz","wsx","edc","rfv","tgb","yhn","ujm","ik,","ol.","p;'"]
             ṙ-                                           -   rotate left -1 = ["p;'","qaz","wsx","edc","rfv","tgb","yhn","ujm","ik,","ol."]
               ØD                                         -   digits = "0123456789"
                  "                                       -   zip with:
                 ;                                        -     concatenate = ["0p;'","1qaz","2wsx","3edc","4rfv","5tgb","6yhn","7ujm","8ik,","9ol."]
                   s2                                     -   split into twos = [["0p;'","1qaz"],["2wsx","3edc"],["4rfv","5tgb"],["6yhn","7ujm"],["8ik,","9ol."]]
                            ¦                             -   sparse application...
                         3,4                              -   ...to indices: [3,4]
                       $€                                 -   ...do: last two links as a monad for each:
                     Ẏ                                    -     tighten
                      W                                   -     wrap in a list = [["0p;'","1qaz"],["2wsx","3edc"],["4rfv5tgb"],["6yhn7ujm"],["8ik,","9ol."]]
                             Ẏ                            -   tighten = ["0p;'","1qaz","2wsx","3edc","4rfv5tgb","6yhn7ujm","8ik,","9ol."]
                                 Q                        -   de-duplicate (the neighbouring letters)
                                Ɱ                         -   map with:
                              œi                          -     multi-dimensional index-into    e.g. "fj" -> [[5,3],[6,7]]
                                                          -     (note <space> is not there so yields an empty list)
                                  Ḣ€                      -   head of each                                -> [5,6]
                                                          -     (...and the head of an empty list is 0)
                                     ¢                    -   call the last Link (1) as a nilad
                                    ị                     -   index-into                                  -> [[55,53],[69,54]]
                                                          -     (...and 0 indexes into the rightmost entry)
                                          Ɗ               -   last three links as a monad:
                                       Ƒ                  -     invariant under?:
                                      Q                   -       de-duplicate (1 if so, else 0)
                                         Z                -       transpose                               -> [[55,69],[53,54]]
                                        ị                 -       index-into                              -> [55,69]
                                           Q              -   de-duplicate                                -> [55,69]
                                                    $     -   last two links as a monad:
                                                  ?       -     if...
                                                 Ḋ        -     ...condition: dequeue
                                            3.75          -     ...then: 3.75
                                                ⁵         -     ...else: 10                               -> 3.75
                                                   ÷      -     divide                                    -> [0.06818181818181818,0.05434782608695652]
                                                     S    -   sum                                         -> 0.12252964426877469
                                                        S - sum

2

05AB1E , 92 86 बाइट्स

Îü)v•δ'ā∍ë*8U¾Ã•₂в45+2ô9ÝÀžV€Sζ‚ø˜ð",.;'"S.;ykD4/ïD3›-D4›-‚©θ讀ËOUεXè}T/zX_iO3*8/ëθ]O

इसे ऑनलाइन आज़माएं या सभी परीक्षण मामलों को सत्यापित करें

स्पष्टीकरण:

Î                     # Push 0 and the input-string
 ü)                   # Create all pairs of the (implicit) input-string
                      # (which will be [] if the input-string is of length 0 or 1)
                      #  i.e. "ab d" → ["a","b"],["b"," "],[" ","d"]]
   v                  # Loop over these pairs `y`:
    •δ'ā∍ë*8U¾Ã•     '#  Push compressed integer 307264255556527588774514
      ₂в              #  Converted to Base-26 as list: [7,1,5,1,8,0,10,8,24,9,18,6,17,7,16,7,20]
        45+           #  Add 45 to each: [52,46,50,46,53,45,55,53,69,54,63,51,62,52,61,52,65]
           2ô         #  Split into parts of size 2: [[52,46],[50,46],[53,45],[55,53],[69,54],[63,51],[62,52],[61,52],[65]]
    9Ý                #  Push list [0,1,2,3,4,5,6,7,8,9]
      À               #  Rotate it once to [1,2,3,4,5,6,7,8,9,0]
       žV             #  Push builtin ["qwertyuiop","asdfghjkl","zxcvbnm"]
         S           #  Convert each to a list of characters
           ζ          #  Zip/transpose; swapping rows/columns, with space as default filler:
                      #   [["q","a","z"],["w","s","x"],["e","d","c"],["r","f","v"],["t","g","b"],["y","h","n"],["u","j","m"],["i","k"," "],["o","l"," "],["p"," "," "]]
            ‚ø        #  Pair it with the digit list, and zip/transpose again
              ˜       #  Then flatten this entire list:
                      #   ["1","q","a","z","2","w","s","x","3","e","d","c","4","r","f","v","5","t","g","b","6","y","h","n","7","u","j","m","8","i","k"," ","9","o","l"," ","0","p"," "," "]
               ð",.;'"S.;
                      #  Replace the four spaces with [",", ".", ";", "'"] in order
     yk               #  Get the indices of the characters in the pair `y` in this list
                      #   i.e. ["b"," "] → [19,-1]
        4/            #  Divide both by 4
                      #   i.e. [19,-1] → [4.75,-0.25]
          ï           #  Floor the decimals to integers
                      #   i.e. [4.75,-0.25] → [4,-1]
           D3›-       #  If an index is larger than 3: decrease it by 1
                      #   i.e. [4,-1] → [3,-1]
               D4›-   #  If an index is now larger than 4: decrease it by 1 again
       D             #  Pair it with the original index
                      #   i.e. [[19,-1],[3,-1]]
                    © #  And save it in the register (without popping)
     θè               #  Then use the last of the two to index into the list of pairs
                      #   i.e. [3,-1] → [[55,53],[65]]
       ®€Ë            #  Check for each pair in the register if they're equal
                      #   i.e. [[19,-1],[3,-1]] → [0,0]
          O           #  Take the sum of that
           U          #  And pop and store it in variable `X`
            ε  }      #  Map the pairs in the list to:
             Xè       #   The `X`'th value in the pair
                      #    i.e. [[55,53],[65]] and `X`=0 → [55,65]
     T/               #  Divide each by 10
                      #   i.e. [55,65] → [5.5,6.5]
       z              #  And take 1/value for each
                      #  i.e. [5.5,6.5] → [0.181...,0.153...]
        X_i           #  If variable `X` was 0:
           O          #   Take the sum of these decimal values
                      #    i.e. [0.181...,0.153...] → 0.335...
            3*8/      #   Multiply it by 3, and then divide it by 8
                      #    i.e. 0.335... → 0.125...
          ë           #  Else:
           θ          #   Pop the pair of decimal values, and only leave the last one
   ]                  # Close both the if-else statement and the loop
    O                 # And take the sum of the stack
                      # (which is output implicitly as result)

(वर्गों मेरा यह 05AB1E टिप देखें कितना बड़ा पूर्णांक संपीड़ित करने के लिए? और कैसे संपीड़ित पूर्णांक सूचियों के लिए? ) को समझने के लिए क्यों •δ'ā∍ë*8U¾Ã•है 307264255556527588774514और •δ'ā∍ë*8U¾Ã•₂вहै [7,1,5,1,8,0,10,8,24,9,18,6,17,7,16,7,20]

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.