QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21592 | #2851. 生生不息 | LFCode# | AC ✓ | 0ms | 3780kb | C++14 | 1.5kb | 2022-03-07 15:52:05 | 2022-05-08 03:40:53 |
Judging History
answer
#include<bits/stdc++.h>
#include<cstdio>
#include<cctype>
#define ll long long
#define PI pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define ui unsigned int
#define pb push_back
#define llu long long unsigned
using namespace std;
const int MB=1<<20;
struct FastIO{
char ib[MB+100],*p,*q;
char ob[MB+100],*r,stk[128];
int tp;
FastIO(){p=q=ib,r=ob,tp=0;}
~FastIO(){fwrite(ob,1,r-ob,stdout);}
char read_char(){if(p==q){p=ib,q=ib+fread(ib,1,MB,stdin);if(p==q)return 0;}return *p++;}
template<typename T>
void read_int(T& x){char c=read_char(),l=0;for(x=0;!isdigit(c);c=read_char())l=c;for(;isdigit(c);c=read_char())x=x*10-'0'+c;if(l=='-')x=-x;}
void write_char(char c){if(r-ob==MB)r=ob,fwrite(ob,1,MB,stdout);*r++=c;}
template<typename T>
void write_int(T x){if(x<0)write_char('-'),x=-x;do stk[++tp]=x%10+'0';while(x/=10);while(tp)write_char(stk[tp--]);}
}IO;
//IO.read_int(a);c=IO.read_char();IO.write_int(a);//IO.write_char(c);
const int N=7;
int T,n,m;
int main(){
scanf("%d",&T);
// T=1;
while(T--){
scanf("%d%d",&n,&m);
if(m<n)swap(n,m);
if(n==1){
printf("0\n");
}
else if(n==2){
if(m==2)printf("5\n");
if(m==3)printf("18\n");
if(m==4)printf("73\n");
if(m==5)printf("267\n");
}
else if(n==3){
if(m==3)printf("150\n");
if(m==4)printf("1533\n");
if(m==5)printf("11398\n");
}
else if(n==4){
if(m==4)printf("31828\n");
if(m==5)printf("469972\n");
}
else{
printf("12785753\n");
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3780kb
input:
25 2 4 2 3 2 1 1 5 4 2 5 4 5 3 2 5 1 4 4 4 5 2 5 1 4 5 3 3 3 2 4 3 5 5 3 1 4 1 3 5 3 4 1 3 1 2 2 2 1 1
output:
73 18 0 0 73 469972 11398 267 0 31828 267 0 469972 150 18 1533 12785753 0 0 11398 1533 0 0 5 0
result:
ok 25 lines