[NYOJ] [acm-62] Han Xin Counts Soldiers

Problem Description

Loading...

Problem Analysis

I came across this problem while reading a book
and remembered that NYOJ hasn’t been counted yet
so I just uploaded it~

This code uses a loop
because the data is tiny~

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<stdio.h>
int main() {
	int a,b,c;
	int i;
	while(scanf("%d %d %d",&a,&b,&c)!=EOF) {
		for(i=10; i<=100; i++) {
			if(i%3==a&&i%5==b&&i%7==c)
			break; 
		}
		if(i<=100)
		printf("%d\n",i);
		else
		printf("No answer\n");
	}
	return 0;
}

Earlier NYOJ was painfully slow too
but it seems much better these past couple of days
Maybe it’s because of the maintenance a while back~
Anyway, now we can enjoy it happily

Problem link: 【NYOJ】[34]Han Xin Counts Soldiers

Loading...