日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Robbers' watch CodeForces - 685A (暴力)

發布時間:2023/12/2 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Robbers' watch CodeForces - 685A (暴力) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

大意: 一天n小時, m分鐘, 表以7進制顯示, 求表顯示數字不同的方案數

?

注意到小時和分鐘部分總長不超過7, 可以直接暴力枚舉.

關鍵要特判0, 0的位數要當做1來處理

#include <iostream> #include <algorithm> #include <cstdio> #include <math.h> #include <set> #include <map> #include <queue> #include <string> #include <string.h> #include <bitset> #define REP(i,a,n) for(int i=a;i<=n;++i) #define PER(i,a,n) for(int i=n;i>=a;--i) #define hr putchar(10) #define pb push_back #define lc (o<<1) #define rc (lc|1) #define mid ((l+r)>>1) #define ls lc,l,mid #define rs rc,mid+1,r #define x first #define y second #define io std::ios::sync_with_stdio(false) #define endl '\n' using namespace std; typedef long long ll; typedef pair<int,int> pii; const int P = 1e9+7, INF = 0x3f3f3f3f; ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;} ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;} ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;} //headconst int N = 1e6+10; int x, y, tx, ty, vis[N]; int chk(int x, int y) {REP(i,0,6) vis[i]=0;REP(i,1,tx) ++vis[x%7],x/=7;REP(i,1,ty) ++vis[y%7],y/=7;REP(i,0,6) if (vis[i]>1) return 0;return 1; }int main() {scanf("%d%d", &x, &y), --x, --y;if ((ll)x*y>6543210) return puts("0"),0;for (int i=x; i; i/=7) ++tx;for (int i=y; i; i/=7) ++ty;tx = max(tx,1), ty = max(ty,1);int ans = 0;REP(i,0,x) REP(j,0,y) ans+=chk(i,j);printf("%d\n", ans); }

?

轉載于:https://www.cnblogs.com/uid001/p/10618067.html

總結

以上是生活随笔為你收集整理的Robbers' watch CodeForces - 685A (暴力)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。