グループリーグ53
久しぶりにグループリーグを...冗談だよ.
A水:
Bは読解問題T_T:
CDEFGは見てない
HがずっとPEなので、、、文字列のテーマが気持ち悪い...
それから大神のコードを見て、、、大賛...
貼り付け:
I問題は難しいですね.最初はYY線分の木を返して、それからリュックサックを感じました.-結局最後まで誰もやらなかった
J問題の署名問題:
A水:
#include<stdio.h>
#include<string.h>
int main(){
char a[33];
int counter;
while(~scanf("%s",a)){
if(a[0]=='#') break;
counter=0;
int len=strlen(a);
for(int i=0;i<len;i++){
if(a[i]=='1') counter++;
}
if(counter%2==0){
if(a[len-1]=='e') a[len-1]='0';
if(a[len-1]=='o') a[len-1]='1';
}
else {
if(a[len-1]=='e') a[len-1]='1';
if(a[len-1]=='o') a[len-1]='0';
}
printf("%s
",a);
}
}
Bは読解問題T_T:
#include<stdio.h>
#include<math.h>
typedef struct
{
double x,y;
}node;
node s,t,ans;
double dis(node a,node b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main()
{
int i,I=1,d;
double r,du;
while( scanf("%lf",&r)!=EOF)
{
scanf("%lf%lf",&s.x,&s.y);
if(r==0&&s.x==0&&s.y==0)break;
i=1;
d=0;
while(scanf("%lf%lf",&t.x,&t.y)!=EOF)
{
if(t.x==-1&&t.y==-1)break;
du=dis(s,t);
if(du<=r+1&&0==d)
{
ans=t;
d=1;
}
s.x+=(t.x-s.x)*(r/du);
s.y+=(t.y-s.y)*(r/du);
i++;
}
printf("Firefly %d ",I++);
if(0==d)printf("not caught
");
else printf("caught at (%.0lf,%.0lf)
",ans.x,ans.y);
}
return 0;
}
CDEFGは見てない
HがずっとPEなので、、、文字列のテーマが気持ち悪い...
それから大神のコードを見て、、、大賛...
貼り付け:
using namespace std;
char decode[]=" ABCDEFGHIJKLMNOPQRSTUVWXYZ',-.?";
int main(){
int spaces=0;
int bits=0;
int code=0;
char c;
while((c=getchar())!='#'){
if(c==' ') ++spaces;
else{
if(spaces>0){
code=(code<<1)+1-(spaces&1);// space , 1 0,+1, space 1 1,+0
spaces=0;
if(++bits==5){
cout<<decode[code];
code=bits=0;}
}
if(c=='*'){
if(bits>0){
cout<<decode[code<<(5-bits)];
code=bits=0;}
cout<<endl;}}}
return 0;
}
I問題は難しいですね.最初はYY線分の木を返して、それからリュックサックを感じました.-結局最後まで誰もやらなかった
J問題の署名問題:
#include<stdio.h>
int main(){
int a,b;
while(~scanf("%d%d",&a,&b)){
printf("%d %d
",b-1,a-1);
}
return 0;
}