2010 ACM-ICPC SEERC

8417 ワード

http://codeforces.com/gym/101464/
5問を超えました
 
J:solived by
/*
  ID: oodt
  PROG:
  LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

using namespace std;

#define rep(i,a,n) for (int i=a;i=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector VI;
typedef long long ll;
typedef pair PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxx=10005;
const int INF = 0x3f3f3f3f;
int n,m,k;
int a[maxx];
int vis[maxx];
int ans = 0,cnt = 0,pos = 0;
int l = 0,r = 0;


int main()
{
#ifdef LOCAL
//    freopen("","r",stdin);
#endif
    freopen("j.in","r",stdin);
    while(~scanf("%d%d",&m,&n))
    {
        printf("%d
",n/(m+1)); } return 0; }
 
E:  solived by
/*
  ID: oodt
  PROG:
  LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

using namespace std;

#define rep(i,a,n) for (int i=a;i=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector VI;
typedef long long ll;
typedef pair PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxx=10005;
const int INF = 0x3f3f3f3f;
int n,m,k;
int a[maxx];
int vis[maxx];
int ans = 0,cnt = 0,pos = 0;
int l = 0,r = 0;


int main()
{
#ifdef LOCAL
//    freopen("","r",stdin);
#endif
    freopen("e.in","r",stdin);
    int n;
    int i;
    double covermax;
    int ans;
    while(scanf("%d",&n)!=EOF)
    {
        ans=0;
        double x;
        for(i=1;i<=n;i++)
        {
            scanf("%lf",&x);
            if(i==1){
                covermax=x+1;
                ans++;
                continue;
            }
            else
            {
                if(x
 
H:solived by
/*
  ID: oodt
  PROG:
  LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

using namespace std;

#define rep(i,a,n) for (int i=a;i=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector VI;
typedef long long ll;
typedef pair PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxx=1005;
const int INF = 0x3f3f3f3f;
int n,m,k;
int b[maxx][maxx];
int c[maxx][maxx];
struct pp{
    ll h,l;
}a[maxx][maxx];
int vis[maxx];
int ans = 0,cnt = 0,pos = 0;
int l = 0,r = 0;


int main()
{
#ifdef LOCAL
//    freopen("","r",stdin);
#endif
     freopen("h.in","r",stdin);
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        memset(c,0,sizeof(c));
        rep(i,1,n+1)
            rep(j,1,n+1)
                scanf("%d",&b[i][j]);
        rep(i,1,n+1){
            rep(j,1,n+1){
                a[i][j].h = a[i][j-1].h + b[i][j];
            }
        }
        rep(j,1,n+1){
            rep(i,1,n+1){
                a[i][j].l = a[i-1][j].l + b[i][j];
            }
        }
        rep(i,1,n+1){
            rep(j,1,n+1){
                if((a[i][j].l & 1) && (a[i][j].h&1))
                {
                    c[i][j] = 0;
                }
                if((a[i][j].l & 1) == 0 && (a[i][j].h & 1) == 0){
                        if(c[i][j-1] && c[i-1][j]) c[i][j] = 0;
                        else c[i][j] = 1;
                }
                if((a[i][j].l & 1) == 0 && (a[i][j].h & 1) == 1){
                    c[i][j] = (c[i][j-1] + 1) % 2;
                }
                if((a[i][j].h & 1) == 0 && (a[i][j].l & 1) == 1){
                    c[i][j] = (c[i-1][j] + 1) % 2;
                }
            }
        }
        if(c[n][n] == 1) printf("W
"); else printf("L
"); } return 0; }
 
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')