Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

給個代媽

Posted by KatrineYang at 2016-11-07 01:08:22 on Problem 1552
#include <stdio.h>
int main() {
	while(1){
		int f;
		scanf("%d",&f);
		if(f>>31)break;
		int st[55] = {0}, gs=0;
		while(1){
			int k;
			scanf("%d",&k);
			if(f<=50){
				st[f]++;
				if(!(st[f]^3))gs++;
			}
			if(!(f%2)){
				st[f/2]+=2;
				if(!(st[f/2]^3))gs++;
			}
			if(!k)break;
			f=k;
		}
		printf("%d\n",gs);
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator