UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212684#3827. AAaron501246ms1216kbC++1.1kb2024-10-20 09:36:192024-10-20 12:37:15

answer

#include<bits/stdc++.h>
//#include<windows.h>
using namespace std;
typedef long long ll;
typedef unsigned long long sll;
const int mod=1e9+7,INF=0x3f3f3f3f;
const long double pie=acos(-1);
#define dist(x1,y1,x2,y2) sqrt( ((x1)-(x2))*((x1)-(x2) + ((y1)-(y2))*((y1)-(y2) ) )
//#define KEY_DOWN(VK_NONAME)((GetAsyncKeyState(VK_NONAME)& 0x8000)? 1:0)
inline int readINT()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    return x*f;
}
char bp[]="0123456789ABCDEF";
string f(int x,int r){
	string ans="";
	while(x){
		int t=x%r;
		ans=ans+bp[t];
		x/=r;
	}
	return ans;
}
bool check(int a,int b,int r){
	string a1=f(a,r),b1=f(b,r);
	int len=min(a1.size(),b1.size());
	for(int i=0;i<len;i++){
		int he=a1[i]+b1[i]-'0'-'0';
		if(he>=r)
			return false;
	}
	return true;
}
signed main(){
	int n=readINT(),cnt=0;
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j++){
			if(check(i,j,2)&&check(i,j,3)){
				if(i==j)
					cnt++;
				else
					cnt+=2;
			}
		}
	}
	cout<<cnt;
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

2

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 1216kb

input:

8

output:

6

result:

ok 1 number(s): "6"

Subtask #2:

score: 20
Accepted

Test #3:

score: 20
Accepted
time: 4ms
memory: 1212kb

input:

92

output:

348

result:

ok 1 number(s): "348"

Test #4:

score: 0
Accepted
time: 4ms
memory: 1216kb

input:

85

output:

316

result:

ok 1 number(s): "316"

Subtask #3:

score: 20
Accepted

Test #5:

score: 20
Accepted
time: 583ms
memory: 1216kb

input:

939

output:

7730

result:

ok 1 number(s): "7730"

Test #6:

score: 0
Accepted
time: 655ms
memory: 1212kb

input:

994

output:

7994

result:

ok 1 number(s): "7994"

Subtask #4:

score: 0
Time Limit Exceeded

Test #7:

score: 0
Time Limit Exceeded

input:

4375

output:


result: