zoukankan      html  css  js  c++  java
  • Codeforces Round #296 (Div. 2)

    第一次做CF,唉,还是基础的东西做的太少,练得不够。

    A.Playing with Paper

    一个折纸游戏,大概意思就是从一个矩形中最多能切割出多少个大小可以不等的正方形。

    已知长和宽a,b,不停地进行切割,上一次切割的宽度变成下一次的长,然后上一次切割的余数成为下一次的宽,然后继续切割直到b为0即切割的时候已经没有剩余。

    #include <iostream>
    #include <algorithm>
    #include <cstdlib>
    #include <cstdio>
    #include <string>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    #include <set>
    using namespace std;
    
    
    #define read() freopen("data.in", "r", stdin)
    #define write() freopen("data.out", "w", stdout)
    #define rep( i , a , b ) for ( int i = ( a ) ; i <  ( b ) ; ++ i )  
    #define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i ) 
    #define clr( a , x ) memset ( a , x , sizeof a )  
    #define cpy( a , x ) memcpy ( a , x , sizeof a ) 
    #define _max(a,b) ((a>b)?(a):(b))
    #define _min(a,b) ((a<b)?(a):(b))
    #define LL long long 
    const int maxNumber=10002;
    
    
    int main()
    {
    	//read();
    	LL a,b;
    	LL cnt;
    	LL temp;
    	while(cin>>a>>b)
    	{
    		cnt = temp = 0;
    		while(b)
    	   {
    		cnt+=a/b;
    		temp=a%b;
    		a=b;
    		b=temp;
    	   }
    	   cout<<cnt<<endl;
    	}
        return 0;
       
    }
    

      

  • 相关阅读:
    mac 快捷键
    mac 配置nginx 虚拟域名(转载)
    StringUtils中 isNotEmpty 和isNotBlank的区别【java字符串判空】
    软件常用版本英文snapshot和ga
    IF条件控制
    函数与方法
    数据类型
    函数 FUNCTION
    集合 SET
    字典 DICTIONARY
  • 原文地址:https://www.cnblogs.com/acmsummer/p/4346132.html
Copyright © 2011-2022 走看看