題意:給定100*100的網格,每個格子可以塗上黑色或者白色(初始時全部樹白色),經過一系列操作後輸出任意一個正方形地區內的黑色格子數。#include <iostream>using namespace std;int c[110][110];int a[110][110];const int n = 100;int lowbit ( int x ){return x & ( -x );}void modify ( int x, int y, int v ){for (
置換群的快速冪在自學polya的時候用到了置換群求冪的迴圈節個數的問題,然後就看看了快速冪。當然也就是《置換群快速冪運算研究與討論》一文了。嗯,確實寫的不錯。這篇文章中有一個題,是慶典的日期的問題,也就是poj 1282。[演算法分析](摘自《置換群快速冪運算 研究與討論》)由於每個房間的轉盤上的數字都是 p 個,而且每年每個祭司都在不同房間,所以我們可以把這些房間中安置的轉盤,轉化成 p 個長度為 n 的置換。而每一年祭司本身的位置,也可以組成一個長度 n 的置換。顯然,第 i 年祭司的位置,
Fence RepairTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 13264 Accepted: 4230DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needsN (1 ≤N ≤ 20,000) planks of
Check the difficulty of problemsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 2661 Accepted: 1155DescriptionOrganizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the
Mayor's postersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 23639 Accepted: 6855DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at
Gold Balanced LineupTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 7565 Accepted: 2236DescriptionFarmer John's N cows (1 ≤ N ≤ 100,000) share many similarities. In fact, FJ has been able to narrow down the list of features shared by his