2010 ACM-ICPC SEERC
8417 ワード
http://codeforces.com/gym/101464/
5問を超えました
J:solived by
E: solived by
H:solived by
A:高精度で、javaで書いていますが、文書を読む操作が要求されています。Bigitegerしかできない人として、javaのリダイレクトができません。研究したのは2時間近く前です。solved by lyy。
B:高精度で、表現の処理もあるので、怠惰にpythonで書いてください。evalは本当に使いやすいです。 ソロved by lyy
5問を超えました
J:solived by
/*
ID: oodt
PROG:
LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
E: solived by
/*
ID: oodt
PROG:
LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
H:solived by
/*
ID: oodt
PROG:
LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
A:高精度で、javaで書いていますが、文書を読む操作が要求されています。Bigitegerしかできない人として、javaのリダイレクトができません。研究したのは2時間近く前です。solved by lyy。
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
Scanner in=new Scanner(new File("A.IN"));
//Scanner in=new Scanner(System.in);
BigInteger a[]=new BigInteger[105];
int n,m;
while (in.hasNext())
{
m=in.nextInt();
n=in.nextInt();
for (int i=1;i<=m;i++)
{
a[i]=BigInteger.ONE;
}
for (int i=1;i<=n;i++)
{
for (int j=1;j<=m;j++)
{
BigInteger x=in.nextBigInteger();
a[j]=a[j].multiply(x);
}
}
BigInteger ans=a[1];
int cnt=1;
for (int i=1;i<=m;i++)
{
if (ans.max(a[i]).equals(a[i]))
{
ans=ans.max(a[i]);
cnt=i;
}
}
System.out.println(cnt);
}
}
}
B:高精度で、表現の処理もあるので、怠惰にpythonで書いてください。evalは本当に使いやすいです。 ソロved by lyy
f=open('b.in','r')
data2=f.readlines()
w=''
for line in data2:
for s in line:
if s!=' ' and s!='\t' and s!='\r':
w=w+s
left=0
data=[]
z=''
for s in w:
if s=='
':
if z!='' and z[-1]>='0'and z[-1]<='9':
data.append(z)
z='';
elif s=='(':
if left==0 and z!='':
data.append(z)
z=''
z=z+s
left+=1
elif s==')':
z=z+s
left-=1
if left==0 and z!='':
data.append(z)
z=''
else:
z=z+s
if (z!=''):
data.append(z)
for line in data:
#print(line)
s=line
s=s.replace('/','//')
l=len(s)
cnt=0;
for i in range(l):
if s[i]=='(':
cnt+=1
try:
r=0
for i in range(l):
if s[i]>='0' and s[i]<='9':
r+=1
else:
r=0
if r>90:
x=1//0
for step in range(cnt):
ss=''
l=len(s)
for i in range(l):
if s[i]=='(':
ss='('
elif s[i]==')':
ss=ss+')'
x=eval(ss)
if (x<0):
x=1//0
x=str(x)
if (len(x)>90):
x=1//0;
s=s.replace(ss,x)
#print(s)
break
else:
ss=ss+s[i]
print(s)
except:
print('Error')