51,683
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 1e5+ 10,M = 1e5 + 10,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
int n;
inline void solve()
{
LL a =0,b=1;
for(int i=0;i < 20 ; i++ )
{
a += 1 << i; b = 1<<i ;
}
printf("%d/%d",a,b);
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Case #";
// cout<< now ++ <<": ";
solve();
}
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 1e5+ 10,M = 1e5 + 10,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
int n;
int d[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool check(int a)
{
string s = to_string(a);
for(int i=0,j=s.size() - 1; i< j ; i ++ , j-- )
if(s[i] != s[j]) return 0;
return 1;
}
bool check1(int x)
{
int t = (x % 10000) /100;
int day = x % 100 ;
if(day > d[t] ) return 0;
if(day <=0 || day > 31 ) return 0;
if(t<= 0 || t > 12 ) return 0;
return 1;
}
inline void solve()
{
cin >> n ;n ++ ;
int u = n ;
fu(i,1000,9999)
{
int t = i ,now = i;while(t) now = now * 10 + t % 10 ,t /=10;
if(check(now) && check1(now) && now >= n )
{
cout << now << endl;break;
}
}
fu(a,1,9)
fu(b,0,9)
if(a != b)
{
int t = a * 1e7 + b * 1e6 + a * 1e5 + b* 1e4 + b * 1e3 + a * 1e2 + b * 10 + a;
if(check(t) && t >= n && check1(t))
{
cout<<t << endl;return;
}
}
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Case #";
// cout<< now ++ <<": ";
solve();
}
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 2e3+ 10,M = 1e5 + 10,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int n,m;
vector<PII> door[N][N];
bool st[N][N],is_door[N][N];
int d[N][N];
void bfs()
{
ms(d,0x3f);
d[n][n] = 0;
queue<PII> q;
q.push({n,n});
while(q.size())
{
auto t = q.front();q.pop();
fu(i,0,3)
{
int a = t.x + dx[i],b= t.y + dy[i];
if(a < 1 || a > n || b < 1 || b > n ) continue;
if(is_door[t.x][t.y])
{
for(auto u:door[t.x][t.y])
{
if(d[u.x][u.y] > d[t.x][t.y] + 1 )
{
d[u.x][u.y] = d[t.x][t.y] + 1;
q.push({u.x,u.y});
}
}
}
if(d[a][b] > d[t.x][t.y] + 1 )
{
d[a][b] = d[t.x][t.y] + 1;
q.push({a,b});
}
}
}
}
inline void solve()
{
cin >> n>> m;
fu(i,0,m-1)
{
int a,b,c,d;cin >> a>> b >> c >> d;
door[a][b].push_back({c,d});
door[c][d].push_back({a,b});
is_door[a][b] = is_door[c][d] = 1;
}
bfs();
int sum =0 ;
fu(i,1,n)
fu(j,1,n)
{
sum += d[i][j];
}
printf("%.2lf",1.0 * sum / ( n * n ));
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Case #";
// cout<< now ++ <<": ";
solve();
}
return 0;
}