[PYTHON] AtCoder Beginner Contest # 003 Participation Note

Yes. http://abc003.contest.atcoder.jp/

A problem At first, I didn't read the problem statement at all, and I struggled with the assumption that the dice were up to 6 pages. .. .. What I wrote is a pattern that turns an expression like the explanation about the sample case with for. However, it seems that the method of 10000 * (1 + N) / 2 was suitable other than turning with this for. It seems that the same value was obtained by multiplying the average of the sums from 1 to N by (1 + N) / 2 and multiplying by 10,000 yen.

A problem


#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import sys
import io
import re
import math
#start = time.time()
start = time.clock()
a = 0
y=10000.0
n = float(raw_input())
for i in range(1,(int(n)+1)):
    a+=(y*i*(1/n))
print a

↑ is what I submitted during the time, ↓ is what I rewrote before going to bed

A Problem rewriting


n=input()
print sum([10000*(x+1)*(1.0/(n)) for x in range(n)])

B problem List the strings, receive them, look at both from the beginning, If it is the same character, go to see the next character If one matches with @, check if the other can be replaced with atcoder If it can be replaced, the next character, otherwise'You will lose' If you finish watching from the beginning to the end,'You can win' Cannot be submitted in time.

python


#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import sys
import io
import re
import math
#start = time.time()
start = time.clock()
i = 0
chk=['a','t','c','o','d','e','r']
 
S = list(raw_input())
T = list(raw_input())
while i<= len(S):
        if i == len(S):
            print 'You can win'
            i+=20
        elif S[i]==T[i]:
            i+=1
        elif S[i]=='@' and T[i] in chk:
            i+=1
            pass
        elif T[i]=='@' and S[i] in chk:
            i+=1
            pass
        else:
            print 'You will lose'
            i+=20

I read a lot of other people's answers because there are various desperate differences in how to handle arrays. .. ..

C problem It seems that it was the easiest question for me because the policy was decided immediately after looking at the problem statement and the sample. I saw A and B earlier, so submission is late. .. I didn't doubt that the number that could be seen from behind by sorting the list in ascending order would be the maximum rate that could achieve.

C problem


#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import sys
import io
import re
import math
#start = time.time()
start = time.clock()
a = 0
sw=0
 
(N, K) = map(float, raw_input().split())
R = map(float, raw_input().split())
x=N-K
R.sort()
for i in range(int(x), int(N)):
#    print a
    a=((R[i])+a)/2
print a

Yes.

Recommended Posts

AtCoder Beginner Contest # 003 Participation Note
AtCoder Beginner Contest 181 Note
AtCoder Beginner Contest 187 Note
AtCoder Beginner Contest 182 Note
AtCoder Beginner Contest 183 Note
AtCoder Beginner Contest 184 Note
AtCoder Beginner Contest 188 Note
AtCoder Beginner Contest 181 Participation Report
AtCoder Beginner Contest 161 Participation Report
AtCoder Beginner Contest 151 Participation Report
AtCoder Beginner Contest 176 Participation Report
AtCoder Beginner Contest 166 Participation Report
AtCoder Beginner Contest 153 Participation Report
AtCoder Beginner Contest 145 Participation Report
AtCoder Beginner Contest 184 Participation Report
AtCoder Beginner Contest 165 Participation Report
AtCoder Beginner Contest 160 Participation Report
AtCoder Beginner Contest 169 Participation Report
AtCoder Beginner Contest 178 Participation Report
AtCoder Beginner Contest 163 Participation Report
AtCoder Beginner Contest 159 Participation Report
AtCoder Beginner Contest 164 Participation Report
AtCoder Beginner Contest 168 Participation Report
AtCoder Beginner Contest 150 Participation Report
AtCoder Beginner Contest 158 Participation Report
AtCoder Beginner Contest 180 Participation Report
AtCoder Beginner Contest 156 Participation Report
AtCoder Beginner Contest 162 Participation Report
AtCoder Beginner Contest 157 Participation Report
AtCoder Beginner Contest 167 Participation Report
AtCoder Beginner Contest 179 Participation Report
AtCoder Beginner Contest 182 Participation Report
AtCoder Beginner Contest 146 Participation Report
AtCoder Beginner Contest 152 Participation Report
AtCoder Beginner Contest 155 Participation Report
AtCoder Beginner Contest 174 Participation Report
AtCoder Beginner Contest 171 Participation Report
AtCoder Beginner Contest 149 Participation Report
AtCoder Beginner Contest 148 Participation Report
AtCoder Beginner Contest 188 Participation Report
Atcoder Beginner Contest 146 Participation Diary
AtCoder Beginner Contest 170 Participation Report
AtCoder Beginner Contest 187 Participation Report
AtCoder Beginner Contest 183 Participation Report
AtCoder Beginner Contest 179
AtCoder Beginner Contest 172
AtCoder Beginner Contest 180
AtCoder Beginner Contest 173
Atcoder Beginner Contest 153
ACL Beginner Contest Note
AtCoder Beginner Contest 166 Review
AtCoder Beginner Contest 167 Review
AtCoder Regular Contest 106 Note
AtCoder Beginner Contest 164 Review
AtCoder Beginner Contest 169 Review
AtCoder Beginner Contest 181 Review
AtCoder Beginner Contest 171 Review
AtCoder Beginner Contest 182 Review
AtCoder Beginner Contest 180 Review
AtCoder Beginner Contest 156 WriteUp
AtCoder Beginner Contest 177 Review