이름 : 임병찬
학교 : 상계제일중학교
경기영재고등학교 예비 신입생입니다.
#include <stdio.h>
int gcd(int a, int b)
{
return a?gcd(b%a,a):b;
}
int main()
{
long long int a,b[101],c[101],d,s=0,t=1,i;
scanf("%lld",&a);
i=a;
while(i--)
{
scanf("%lld%lld",&b[i],&c[i]);
}
for(i=a-1;i>=0;i--)
{
s=s*c[i]+t*b[i];
t=t*c[i];
d=s;
s=s/gcd(s,t);
t=t/gcd(d,t);
}
printf("%lld/%lld",s,t);
return 0;
}
#include <stdio.h>
int x[510][510],y[510][510],a;
int func(int i, int j,int h)
{
int t=0;
if(0<i&&i<=a&&0<j&&j<=a);
else return 0;
if(y[i][j]==0)
{
y[i][j]=1;
if(-h<=x[i][j]-x[i][j+1]&&x[i][j]-x[i][j+1]<=h) t+=func(i,j+1,h);
if(-h<=x[i][j]-x[i][j-1]&&x[i][j]-x[i][j-1]<=h) t+=func(i,j-1,h);
if(-h<=x[i][j]-x[i+1][j]&&x[i][j]-x[i+1][j]<=h) t+=func(i+1,j,h);
if(-h<=x[i][j]-x[i-1][j]&&x[i][j]-x[i-1][j]<=h) t+=func(i-1,j,h);
return t+1;
}
else return 0;
}
int main()
{
int m,b,i,j;
double h,max=0x8000000,min=0,result=0;
scanf("%d",&a);
for(i=1;i<=a;i++) for(j=1;j<=a;j++) scanf("%d",&x[i][j]);
while(1)
{
m=0;
h=(max+min)/2;
for(i=1;i<=a;i++) for(j=1;j<=a;j++) y[i][j]=0;
for(i=1;i<=a;i++)
{
for(j=1;j<=a;j++)
{
if(y[i][j]==0)
{
b=func(i,j,h);
m=m>b?m:b;
}
}
}
if(m>=(a*a+1)/2)
{
if(-0.0001<result-h&&result-h<0.0001)
{
printf("%d",(int)result+1);
return 0;
}
result=h;
max=h;
}
else min=h;
}
}
#include<stdio.h>
main()
{
long long n, a, b;
scanf("%lld", &n);
a=n/12;
b=n%12;
switch(b)
{
case 0: printf("%lld", 3*a*a); break;
case 1: case 4: printf("%lld", 3*a*a+2*a); break;
case 2: printf("%lld", 3*a*a+a); break;
case 3: case 6: printf("%lld", 3*a*a+3*a+1); break;
case 5: case 8: printf("%lld", 3*a*a+4*a+1); break;
case 7: printf("%lld", 3*a*a+14*a+2); break;
case 9: printf("%lld", 3*a*a+6*a+3); break;
case 10: printf("%lld", 3*a*a+5*a+2); break;
default: printf("%lld", 3*a*a+7*a+4); break;
}
}
#include <stdio.h>
struct str{
int x0;
int y0;
int number;
}x[10010];
int main()
{
double h,min,max;
int a,b,c,d,e,i,count=30,s;
scanf("%d%d",&a,&b);
for(i=1;i<=a;i++)
{
scanf("%d%d%d",&c,&d,&e);
x[i]={c,d,e};
}
min=0,max=20000;
while(count--)
{
h=(min+max)/2;
s=b;
for(i=1;i<=a;i++) if(x[i].x0*x[i].x0+x[i].y0*x[i].y0<=h*h) s+=x[i].number;
if(s>=1000000) max=h;
else min=h;
}
if(max==20000) printf("-1");
else printf("%.3lf",h);
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
이때부터 시작한거로군...