logo
Thailand Competitive Programming Wiki
กบ (frog)
Initializing search
    thai-cp/thai-cp.github.io
    • Home
    • Road Map
    • ทั่วไป
    • การเขียนโปรแกรมเบื้องต้น
    • โครงสร้างข้อมูลและอัลกอริทึมพื้นฐาน
    • โจทย์
    thai-cp/thai-cp.github.io
    • Home
      • พื้นฐาน (Basic)
      • อะไรคือ Competitive Programming?
      • สอวน. คอมพิวเตอร์
      • แหล่งเรียนรู้
      • บทนำ
      • วิธีการรันโปรแกรม
        • Hello, World!
        • ตัวแปร ชนิดข้อมูล และตัวดำเนินการ
        • การส่งออกและนำเข้าข้อมูล
        • คำสั่ง if - else
        • คำสั่งวนซ้ำ (Loop)
        • ตัวแปรชุด และสายอักขระ
        • ฟังก์ชัน
        • ตัวแปรโครงสร้าง (Struct)
        • ตัวชี้ (Pointer)
        • Hello, World!
        • ตัวแปร ชนิดข้อมูล และตัวดำเนินการ
        • การส่งออกและนำเข้าข้อมูล
        • คำสั่ง if - else
        • คำสั่งวนซ้ำ (Loop)
        • ตัวแปรชุด และสายอักขระ
        • ฟังก์ชัน
        • ตัวแปรโครงสร้าง (Struct)
        • ตัวชี้ (Pointer)
      • Complexity Analysis
      • Intro to Data Structures
      • Binary Search
      • Sorting Algorithms
      • Prefix Sum
      • Linked List
      • Stack
      • Queue
    • โจทย์

    กบ (frog)

    Author: Pakin Olanraktham


    View Problem Statement

    Source: PROGRAMMING.IN.TH

    Difficulty: ?

    Prerequisites:

    • การเขียนโปรแกรมเบื้องต้น
    เฉลย
    #include <stdio.h>
    
    int main() {
        int a, b;
        scanf("%d %d", &a, &b);
        printf("%d", b/a + (b%a==0?0:1) + (a>b?1:0));
    }
    
    #include <iostream>
    
    using namespace std;
    
    int main() {
        int a, b;
        cin >> a >> b;
        cout << b/a + (b%a==0?0:1) + (a>b?1:0);
    }
    
    © 2025 Thailand Competitive Programming — Licensed under CC BY-NC-SA 4.0
    Made with Material for MkDocs