Codeforces Round #296 (Div. 2)

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

A.Playing with Paper

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#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;
    
}

  

posted @   Summer先生  阅读(165)  评论(0编辑  收藏  举报
编辑推荐:
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
阅读排行:
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· .NET 原生驾驭 AI 新基建实战系列(一):向量数据库的应用与畅想
· Ai满嘴顺口溜,想考研?浪费我几个小时
· Browser-use 详细介绍&使用文档
· 软件产品开发中常见的10个问题及处理方法
点击右上角即可分享
微信分享提示