maoxiantongxue's blog

By maoxiantongxue, history, 2 months ago, In English

It it an easy problem. We just need to write the "gcd" function first. Here is the code. ~~~~~

include

using namespace std; int gcd(int x, int y){ if(x%y==0) return y; else return gcd(y,x%y); } int main(){ int Y,W,D,big,small,a; cin>>Y>>W; if(Y-W>0){ big=Y; small=W; } else{ big=W; small=Y; } D=6-big+1; a=gcd(D,6); D=D/a; cout<<D<<"/"<<6/a<<endl; return 0; } ~~~~~

Read more »

 
 
 
 
  • Vote: I like it
  • -18
  • Vote: I do not like it

By maoxiantongxue, history, 2 months ago, In English

It seems that problem 1A is very easy. But if the types of datum is int, you'll find that your answer can never be accepted, because the types of datum which the system inputs is long long. Here's the code.

#include<>													//the headfile
using namespace std;
int main(){
	int n,m,a;												//define the datum
	cin>>n>>m>>a;											//input the datum
	cout<<(long long)(ceil(n/(double)a)*ceil(m/(double)a));	//output the answer
	return 0;
}

Attention: This code has been changed, please do not Ctrl+C and Ctrl+V. This is also my first blog

Read more »

 
 
 
 
  • Vote: I like it
  • -32
  • Vote: I do not like it