头像

simple_34




离线:1天前


最近来访(23)
用户头像
TheForsaking
用户头像
HaoqiCat
用户头像
pdsuacm06
用户头像
我叫蒟蒻
用户头像
ㅤㅤ_ㅤㅤ
用户头像
23计科新生
用户头像
刘铠朗
用户头像
Mendoza
用户头像
艾久夕
用户头像
你好流星
用户头像
一块两毛五
用户头像
煜宸
用户头像
yzj_
用户头像
typedef
用户头像
zjy_5
用户头像
Yusorai
用户头像
Code_星云
用户头像
harper886
用户头像
伴ing
用户头像
仙贝


include[HTML_REMOVED]

using namespace std;
const int N = 1010,MOD = 100000007;

int f[N][N];
int d(int a,int b)
{
return (a%b+b) % b;
}

int main()
{
int n,s,a,b;
cin >> n >> s >> a >> b;
f[0][0] = 1;
for(int i=1; i<n; i){
for(int j=0; j<n;
j){
f[i][j] = ( f[i-1][d(j-a(n-i),n)] + f[i-1][d(j+b(n-i),n)] ) % MOD;
}
}
cout<<f[n-1][d(s,n)]<<endl;
return 0;
}




include[HTML_REMOVED]

using namespace std;
int main()
{
const int N = 55;
int w[N][N];
int f[N][N][13][14];
int n, m, k;
const int mod = 1e9 + 7;
cin >> n >> m >> k;
for (int i = 1; i <= n; i) {
for (int j = 1; j <= m; j
) {
cin >> w[i][j];
w[i][j];
}
}
f[1][1][1][w[1][1]] = 1;
f[1][1][0][0] = 1;
for (int i = 1; i <= n; i
) {
for (int j = 1; j <= m; j) {
if (i == 1 && j == 1)
continue;
for (int u = 0; u <= k; u
) {
for (int v = 0; v <= 13; v) {
int& val = f[i][j][u][v];
val = (val + f[i - 1][j][u][v]) % mod;
val = (val + f[i][j - 1][u][v]) % mod;
if (u > 0 && v == w[i][j]) {
for (int c = 0; c < v; c
) {
val = (val + f[i - 1][j][u - 1][c]) % mod;
val = (val + f[i][j - 1][u - 1][c]) % mod;
}

                }
            }
        }
    }
}
int res = 0;
for (int i = 0; i <= 13; i++)
    res = (res + f[n][m][k][i]) % mod;
cout << res << endl;

}




include[HTML_REMOVED]

using namespace std;
int main()
{
const int N = 1010;
int v[N];
int w[N];
int f[N][N];
int n,m;
scanf(“%d%d”,&n,&m);
for(int i = 1;i <= n;i ) scanf(“%d%d”,&v[i],&w[i]);
for(int i = 1;i <= n;i
){
for(int j = 0;j <= m;j ++){
if(j < v[i]) f[i][j] = f[i - 1][j];
else f[i][j] = max(f[i - 1][j],f[i - 1][j - v[i]] + w[i]);
}
}
printf(“%d”,f[n][m]);
}




include[HTML_REMOVED]

using namespace std;
int main()
{
int n;
cin >> n;
int res = n;
while(n >= 3){
res += n / 3;
n = n % 3 + n / 3;
}
cout << res << endl;
}




include[HTML_REMOVED]

using namespace std;
int main()
{
int n;
scanf(“%d”, &n);
int pivot, left = 0, right = 0;
scanf(“%d”, &pivot);

for (int i = 1; i < n; i++)
{
    int x;
    scanf("%d", &x);
    if (abs(x) < abs(pivot) && x > 0) right++;
    if (abs(x) > abs(pivot) && x < 0) left++;
}
if ((pivot < 0 && right == 0) || pivot > 0 && left == 0) puts("1");
else printf("%d\n", left + right + 1);

}




include[HTML_REMOVED]

using namespace std;
int f[5010][5010],n,m,r,c,x,y,z,i,j,a;
int main()
{
cin>>n>>m;
r=c=m;
for(i=1; i<=n; i)
{
scanf(“%d%d%d”,&x,&y,&z);
x
,y;
f[x][y]=z;
r=max(r,x);
c=max(c,y);
}
for(i=1; i<=r; i
)
for(j=1; j<=c; j)
f[i][j]=f[i-1][j]+f[i][j-1]-f[i-1][j-1]+f[i][j];
for(i=m; i<=r; i
)
for(j=m; j<=c; j++)
a=max(a,f[i][j]-f[i][j-m]-f[i-m][j]+f[i-m][j-m]);
cout<<a<<endl;
}




include[HTML_REMOVED]

using namespace std;
const int N=100010;
typedef long long ll;
int sum[N],a[N],r[N];
int n,k;
ll an=0;
int main(){
cin>>n>>k;
for(int i=1;i<=n;i){
cin>>a[i];
sum[i]=(sum[i-1]+a[i])%k;
an+=r[sum[i]];
r[sum[i]]
;
}
cout<<an+r[0]<<endl;
return 0;
}




include[HTML_REMOVED]

using namespace std;
int n,k,a[100001],b[100001],l,r=1e9,m;
bool f(int m){
int c=0;
for(int i=1;i<=n;i)
c+=(a[i]/m)*(b[i]/m);
return c>=k;
}
int main(){
cin>>n>>k;
for(int i=1;i<=n;i
)
cin>>a[i]>>b[i];
while(l[HTML_REMOVED]>1;
if(f(m))
l=m;
else
r=m-1;
}
cout<<l;
}




include[HTML_REMOVED]

using namespace std;
int main()
{
int n,a,b,c,d;
scanf(“%d”,&n);
int s = int(sqrt(n));
for(a=0;a<=s;a)
{
for(b=a;b<=s;
b)
{
for(c=b;c<=s;++c)
{
d=sqrt(n-aa-bb-cc);
if(n==a
a+bb+cc+d*d)
{
if(c>d)swap(d,c);
printf(“%d %d %d %d\n”,a,b,c,d);
return 0;
}
}
}
}
}




include[HTML_REMOVED]

using namespace std;

define N 100010

int t[N];
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
scanf(“%d”, &t[i]);
int ans = 0;
for (int i = n - 1; i >= 0; –i)
ans = (ans + t[i] + 1) / 2;
cout << ans;
}