投資錢景>買台積電就對了女大生禁不起誘惑!按了..正妹的東京自助旅行晚會結束續攤大腸花 學...
2013-08-11 15:29:40 人氣(137) | 回應(0) | 推薦(0) | 收藏(0) 上一篇 | 下一篇

[UVA] 11298 - Dissecting a Hexagon

0
收藏
0
推薦


 D. Dissecting a Hexagon 

Problem

Given an integer n, determine whether it is possible to dissect/divide a regular hexagon into n parallelograms of equal area. An example of a hexagon dissected into 3 parallelograms is given below.

The Input

There is at most 800 inputs. Each input is n (n<1000001) on a single line.

The Output

For each input, output the answer on a single line. Output 1 if it is possible to dissect a regular hexagon into n parallelograms, otherwise output 0.

Sample Input

2
147

Sample Output

0
1


Problem setter: Josh Bao

猜猜看,從範例輸入考量。

#include <stdio.h>

int main() {
    int n;
    while(scanf("%d", &n) == 1) {
        puts(n >= 3 && n%3 == 0 ? "1" : "0");
    }
    return 0;
}

11298Dissecting a Hexagon
台長:Morris
人氣(137) | 回應(0)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 教育學習(進修、留學、學術研究、教育概況) | 個人分類: UVA |
此分類下一篇:[UVA] 11393 - Tri-Isomorphism
此分類上一篇:[UVA] 11246 - K-Multiple Free set

我要回應
是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入以下數字 (ex:123)

(有*為必填)
詳全文